зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187139 (part 2) - Replace nsBaseHashtable::Enumerate() calls in accessible/ with iterators. r=tbsaunde.
--HG-- extra : rebase_source : 1362c77b2a88ea1f02a549a18086986b73b419e4
This commit is contained in:
Родитель
ca220cda4d
Коммит
1a8b28c439
|
@ -13,14 +13,16 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
static PLDHashOperator
|
||||
UnbindCacheEntryFromDocument(const void* aKey, RefPtr<T>& aAccessible,
|
||||
void* aUserArg)
|
||||
void
|
||||
UnbindCacheEntriesFromDocument(
|
||||
nsRefPtrHashtable<nsPtrHashKey<const void>, T>& aCache)
|
||||
{
|
||||
MOZ_ASSERT(aAccessible && !aAccessible->IsDefunct());
|
||||
aAccessible->Document()->UnbindFromDocument(aAccessible);
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
for (auto iter = aCache.Iter(); !iter.Done(); iter.Next()) {
|
||||
T* accessible = iter.Data();
|
||||
MOZ_ASSERT(accessible && !accessible->IsDefunct());
|
||||
accessible->Document()->UnbindFromDocument(accessible);
|
||||
iter.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,8 +145,9 @@ XULTreeAccessible::Value(nsString& aValue)
|
|||
void
|
||||
XULTreeAccessible::Shutdown()
|
||||
{
|
||||
if (!mDoc->IsDefunct())
|
||||
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>, nullptr);
|
||||
if (!mDoc->IsDefunct()) {
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
}
|
||||
|
||||
mTree = nullptr;
|
||||
mTreeView = nullptr;
|
||||
|
@ -550,8 +551,7 @@ XULTreeAccessible::InvalidateCache(int32_t aRow, int32_t aCount)
|
|||
return;
|
||||
|
||||
if (!mTreeView) {
|
||||
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>,
|
||||
nullptr);
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -609,8 +609,7 @@ XULTreeAccessible::TreeViewInvalidated(int32_t aStartRow, int32_t aEndRow,
|
|||
return;
|
||||
|
||||
if (!mTreeView) {
|
||||
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>,
|
||||
nullptr);
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -669,8 +668,7 @@ XULTreeAccessible::TreeViewChanged(nsITreeView* aView)
|
|||
Document()->FireDelayedEvent(reorderEvent);
|
||||
|
||||
// Clear cache.
|
||||
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>,
|
||||
nullptr);
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
|
||||
mTreeView = aView;
|
||||
}
|
||||
|
@ -687,7 +685,7 @@ XULTreeAccessible::CreateTreeItemAccessible(int32_t aRow) const
|
|||
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeItemAccessibleBase
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -277,8 +277,7 @@ void
|
|||
XULTreeGridRowAccessible::Shutdown()
|
||||
{
|
||||
if (!mDoc->IsDefunct()) {
|
||||
mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<XULTreeGridCellAccessible>,
|
||||
nullptr);
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
}
|
||||
|
||||
XULTreeItemAccessibleBase::Shutdown();
|
||||
|
|
Загрузка…
Ссылка в новой задаче