mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1187142 - Replace nsBaseHashtable::Enumerate() calls in hal/ with iterators. r=dhylands.
This commit is contained in:
parent
9dd8d8900f
commit
3be952558d
@ -72,31 +72,6 @@ CountWakeLocks(ProcessLockTable* aTable, LockCount* aTotalCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLDHashOperator
|
|
||||||
RemoveChildFromList(const nsAString& aKey, nsAutoPtr<ProcessLockTable>& aTable,
|
|
||||||
void* aUserArg)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aUserArg);
|
|
||||||
|
|
||||||
PLDHashOperator op = PL_DHASH_NEXT;
|
|
||||||
uint64_t childID = *static_cast<uint64_t*>(aUserArg);
|
|
||||||
if (aTable->Get(childID, nullptr)) {
|
|
||||||
aTable->Remove(childID);
|
|
||||||
|
|
||||||
LockCount totalCount;
|
|
||||||
CountWakeLocks(aTable, &totalCount);
|
|
||||||
if (!totalCount.numLocks) {
|
|
||||||
op = PL_DHASH_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sActiveListeners) {
|
|
||||||
NotifyWakeLockChange(WakeLockInfoFromLockCount(aKey, totalCount));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return op;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ClearHashtableOnShutdown final : public nsIObserver {
|
class ClearHashtableOnShutdown final : public nsIObserver {
|
||||||
~ClearHashtableOnShutdown() {}
|
~ClearHashtableOnShutdown() {}
|
||||||
public:
|
public:
|
||||||
@ -145,7 +120,25 @@ CleanupOnContentShutdown::Observe(nsISupports* aSubject, const char* aTopic, con
|
|||||||
nsresult rv = props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"),
|
nsresult rv = props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"),
|
||||||
&childID);
|
&childID);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
sLockTable->Enumerate(RemoveChildFromList, &childID);
|
for (auto iter = sLockTable->Iter(); !iter.Done(); iter.Next()) {
|
||||||
|
nsAutoPtr<ProcessLockTable>& table = iter.Data();
|
||||||
|
|
||||||
|
if (table->Get(childID, nullptr)) {
|
||||||
|
table->Remove(childID);
|
||||||
|
|
||||||
|
LockCount totalCount;
|
||||||
|
CountWakeLocks(table, &totalCount);
|
||||||
|
|
||||||
|
if (sActiveListeners) {
|
||||||
|
NotifyWakeLockChange(WakeLockInfoFromLockCount(iter.Key(),
|
||||||
|
totalCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalCount.numLocks == 0) {
|
||||||
|
iter.Remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("ipc:content-shutdown message without childID property");
|
NS_WARNING("ipc:content-shutdown message without childID property");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user