mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 21:55:31 +00:00
Bug 1182980 - Part 4: Use nsTHashtable::Iterator in nsWindowMemoryReporter::UnlinkGhostWindows. r=khuey
This commit is contained in:
parent
ad8fffc614
commit
af3cfe9011
@ -921,23 +921,6 @@ nsWindowMemoryReporter::KillCheckTimer()
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static PLDHashOperator
|
||||
UnlinkGhostWindowsEnumerator(nsUint64HashKey* aIDHashKey, void *)
|
||||
{
|
||||
nsGlobalWindow::WindowByIdTable* windowsById =
|
||||
nsGlobalWindow::GetWindowsTable();
|
||||
if (!windowsById) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsRefPtr<nsGlobalWindow> window = windowsById->Get(aIDHashKey->GetKey());
|
||||
if (window) {
|
||||
window->RiskyUnlink();
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsWindowMemoryReporter::UnlinkGhostWindows()
|
||||
{
|
||||
@ -959,6 +942,17 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
|
||||
// Get the IDs of all the "ghost" windows, and unlink them all.
|
||||
nsTHashtable<nsUint64HashKey> ghostWindows;
|
||||
sWindowReporter->CheckForGhostWindows(&ghostWindows);
|
||||
ghostWindows.EnumerateEntries(UnlinkGhostWindowsEnumerator, nullptr);
|
||||
for (auto iter = ghostWindows.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsGlobalWindow::WindowByIdTable* windowsById =
|
||||
nsGlobalWindow::GetWindowsTable();
|
||||
if (!windowsById) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsRefPtr<nsGlobalWindow> window = windowsById->Get(iter.Get()->GetKey());
|
||||
if (window) {
|
||||
window->RiskyUnlink();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user