зеркало из https://github.com/mozilla/gecko-dev.git
Bug 814822 - Notify wake lock change when content crashes. r=jlebar
This commit is contained in:
Родитель
a0dbf6da95
Коммит
4bec908ccc
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче