Bug 1182980 - Part 8: Use nsTHashtable::Iterator in nsIDocument::EnumerateActivityObservers. r=khuey

This commit is contained in:
Birunthan Mohanathas 2015-07-22 09:42:01 -07:00
parent 5304d637cf
commit c0ef5c2cdf

View File

@ -10186,27 +10186,17 @@ nsIDocument::UnregisterActivityObserver(nsISupports* aSupports)
return true;
}
struct EnumerateActivityObserversData {
nsIDocument::ActivityObserverEnumerator mEnumerator;
void* mData;
};
static PLDHashOperator
EnumerateObservers(nsPtrHashKey<nsISupports>* aEntry, void* aData)
{
EnumerateActivityObserversData* data = static_cast<EnumerateActivityObserversData*>(aData);
data->mEnumerator(aEntry->GetKey(), data->mData);
return PL_DHASH_NEXT;
}
void
nsIDocument::EnumerateActivityObservers(ActivityObserverEnumerator aEnumerator,
void* aData)
{
if (!mActivityObservers)
return;
EnumerateActivityObserversData data = { aEnumerator, aData };
mActivityObservers->EnumerateEntries(EnumerateObservers, &data);
for (auto iter = mActivityObservers->ConstIter(); !iter.Done();
iter.Next()) {
aEnumerator(iter.Get()->GetKey(), aData);
}
}
void