mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1181445 (part 2) - Use nsTHashTable::Iterator in nsMemoryReporterManager. r=froydnj.
This commit is contained in:
parent
099f5c1870
commit
1840f58314
@ -1400,24 +1400,6 @@ nsMemoryReporterManager::StartGettingReports()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
typedef nsCOMArray<nsIMemoryReporter> MemoryReporterArray;
|
||||
|
||||
static PLDHashOperator
|
||||
StrongEnumerator(nsRefPtrHashKey<nsIMemoryReporter>* aElem, void* aData)
|
||||
{
|
||||
MemoryReporterArray* allReporters = static_cast<MemoryReporterArray*>(aData);
|
||||
allReporters->AppendElement(aElem->GetKey());
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
WeakEnumerator(nsPtrHashKey<nsIMemoryReporter>* aElem, void* aData)
|
||||
{
|
||||
MemoryReporterArray* allReporters = static_cast<MemoryReporterArray*>(aData);
|
||||
allReporters->AppendElement(aElem->GetKey());
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemoryReporterManager::GetReportsForThisProcess(
|
||||
nsIHandleReportCallback* aHandleReport,
|
||||
@ -1448,11 +1430,17 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended(
|
||||
MOZ_ASSERT(!aDMDFile);
|
||||
#endif
|
||||
|
||||
MemoryReporterArray allReporters;
|
||||
nsCOMArray<nsIMemoryReporter> allReporters;
|
||||
{
|
||||
mozilla::MutexAutoLock autoLock(mMutex);
|
||||
mStrongReporters->EnumerateEntries(StrongEnumerator, &allReporters);
|
||||
mWeakReporters->EnumerateEntries(WeakEnumerator, &allReporters);
|
||||
for (auto iter = mStrongReporters->Iter(); !iter.Done(); iter.Next()) {
|
||||
nsRefPtrHashKey<nsIMemoryReporter>* entry = iter.Get();
|
||||
allReporters.AppendElement(entry->GetKey());
|
||||
}
|
||||
for (auto iter = mWeakReporters->Iter(); !iter.Done(); iter.Next()) {
|
||||
nsPtrHashKey<nsIMemoryReporter>* entry = iter.Get();
|
||||
allReporters.AppendElement(entry->GetKey());
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < allReporters.Length(); i++) {
|
||||
allReporters[i]->CollectReports(aHandleReport, aHandleReportData,
|
||||
|
Loading…
Reference in New Issue
Block a user