mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 814822 - Notify wake lock change when content crashes. r=jlebar
This commit is contained in:
parent
909d2e8440
commit
a72916e8c5
@ -53,17 +53,6 @@ static StaticAutoPtr<LockTable> sLockTable;
|
||||
static bool sInitialized = false;
|
||||
static bool sIsShuttingDown = false;
|
||||
|
||||
static PLDHashOperator
|
||||
RemoveChildFromList(const nsAString& aKey, ProcessLockTable* aTable, void* aUserArg)
|
||||
{
|
||||
MOZ_ASSERT(aUserArg);
|
||||
|
||||
uint64_t childID = *static_cast<uint64_t*>(aUserArg);
|
||||
aTable->Remove(childID);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
CountWakeLocks(const uint64_t& aKey, LockCount aCount, void* aUserArg)
|
||||
{
|
||||
@ -76,6 +65,31 @@ CountWakeLocks(const uint64_t& aKey, LockCount aCount, void* aUserArg)
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
RemoveChildFromList(const nsAString& aKey, ProcessLockTable* aTable, void* aUserArg)
|
||||
{
|
||||
MOZ_ASSERT(aUserArg);
|
||||
|
||||
uint64_t childID = *static_cast<uint64_t*>(aUserArg);
|
||||
if (aTable->Get(childID, NULL)) {
|
||||
aTable->Remove(childID);
|
||||
if (sActiveListeners) {
|
||||
LockCount totalCount;
|
||||
WakeLockInformation info;
|
||||
aTable->EnumerateRead(CountWakeLocks, &totalCount);
|
||||
if (!totalCount.numLocks) {
|
||||
sLockTable->Remove(aKey);
|
||||
}
|
||||
info.numLocks() = totalCount.numLocks;
|
||||
info.numHidden() = totalCount.numHidden;
|
||||
info.topic() = aKey;
|
||||
NotifyWakeLockChange(info);
|
||||
}
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
class ClearHashtableOnShutdown MOZ_FINAL : public nsIObserver {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -162,6 +176,8 @@ ModifyWakeLockInternal(const nsAString& aTopic,
|
||||
hal::WakeLockControl aHiddenAdjust,
|
||||
uint64_t aProcessID)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (sIsShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user