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
426b2f28c8
commit
37437f9afd
@ -1400,24 +1400,6 @@ nsMemoryReporterManager::StartGettingReports()
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsMemoryReporterManager::GetReportsForThisProcess(
|
nsMemoryReporterManager::GetReportsForThisProcess(
|
||||||
nsIHandleReportCallback* aHandleReport,
|
nsIHandleReportCallback* aHandleReport,
|
||||||
@ -1448,11 +1430,17 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended(
|
|||||||
MOZ_ASSERT(!aDMDFile);
|
MOZ_ASSERT(!aDMDFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MemoryReporterArray allReporters;
|
nsCOMArray<nsIMemoryReporter> allReporters;
|
||||||
{
|
{
|
||||||
mozilla::MutexAutoLock autoLock(mMutex);
|
mozilla::MutexAutoLock autoLock(mMutex);
|
||||||
mStrongReporters->EnumerateEntries(StrongEnumerator, &allReporters);
|
for (auto iter = mStrongReporters->Iter(); !iter.Done(); iter.Next()) {
|
||||||
mWeakReporters->EnumerateEntries(WeakEnumerator, &allReporters);
|
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++) {
|
for (uint32_t i = 0; i < allReporters.Length(); i++) {
|
||||||
allReporters[i]->CollectReports(aHandleReport, aHandleReportData,
|
allReporters[i]->CollectReports(aHandleReport, aHandleReportData,
|
||||||
|
Loading…
Reference in New Issue
Block a user