Bug 1187139 (part 1) - Replace nsBaseHashtable::Enumerate() calls in accessible/ with iterators. r=tbsaunde.

--HG--
extra : rebase_source : 4cc04928bee921db2088af358439958d5d2fd6f5
This commit is contained in:
Nicholas Nethercote 2015-11-29 14:02:07 -08:00
Родитель d89b2a6a22
Коммит ca220cda4d
1 изменённых файлов: 8 добавлений и 16 удалений

Просмотреть файл

@ -12,20 +12,6 @@
// Accessible cache utils
////////////////////////////////////////////////////////////////////////////////
/**
* Shutdown and removes the accessible from cache.
*/
template <class T>
static PLDHashOperator
ClearCacheEntry(const void* aKey, RefPtr<T>& aAccessible, void* aUserArg)
{
NS_ASSERTION(aAccessible, "Calling ClearCacheEntry with a nullptr pointer!");
if (aAccessible && !aAccessible->IsDefunct())
aAccessible->Shutdown();
return PL_DHASH_REMOVE;
}
template <class T>
static PLDHashOperator
UnbindCacheEntryFromDocument(const void* aKey, RefPtr<T>& aAccessible,
@ -40,12 +26,18 @@ UnbindCacheEntryFromDocument(const void* aKey, RefPtr<T>& aAccessible,
/**
* Clear the cache and shutdown the accessibles.
*/
template <class T>
static void
ClearCache(nsRefPtrHashtable<nsPtrHashKey<const void>, T>& aCache)
{
aCache.Enumerate(ClearCacheEntry<T>, nullptr);
for (auto iter = aCache.Iter(); !iter.Done(); iter.Next()) {
T* accessible = iter.Data();
MOZ_ASSERT(accessible);
if (accessible && !accessible->IsDefunct()) {
accessible->Shutdown();
}
iter.Remove();
}
}
#endif