зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1290116 P1 Expose a ServiceWorkerRegistrationInfo::IsIdle() method. r=asuth
This commit is contained in:
Родитель
da1166fba2
Коммит
20caf371e2
|
@ -223,7 +223,7 @@ ServiceWorkerRegistrationInfo::TryToActivate()
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
bool controlling = IsControllingDocuments();
|
bool controlling = IsControllingDocuments();
|
||||||
bool skipWaiting = mWaitingWorker && mWaitingWorker->SkipWaitingFlag();
|
bool skipWaiting = mWaitingWorker && mWaitingWorker->SkipWaitingFlag();
|
||||||
bool idle = !mActiveWorker || mActiveWorker->WorkerPrivate()->IsIdle();
|
bool idle = IsIdle();
|
||||||
if (idle && (!controlling || skipWaiting)) {
|
if (idle && (!controlling || skipWaiting)) {
|
||||||
Activate();
|
Activate();
|
||||||
}
|
}
|
||||||
|
@ -519,4 +519,10 @@ ServiceWorkerRegistrationInfo::TransitionWaitingToActive()
|
||||||
WhichServiceWorker::ACTIVE_WORKER);
|
WhichServiceWorker::ACTIVE_WORKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ServiceWorkerRegistrationInfo::IsIdle() const
|
||||||
|
{
|
||||||
|
return !mActiveWorker || mActiveWorker->WorkerPrivate()->IsIdle();
|
||||||
|
}
|
||||||
|
|
||||||
END_WORKERS_NAMESPACE
|
END_WORKERS_NAMESPACE
|
||||||
|
|
|
@ -171,6 +171,10 @@ public:
|
||||||
// worker is updated to the Activating state.
|
// worker is updated to the Activating state.
|
||||||
void
|
void
|
||||||
TransitionWaitingToActive();
|
TransitionWaitingToActive();
|
||||||
|
|
||||||
|
// Determine if the registration is actively performing work.
|
||||||
|
bool
|
||||||
|
IsIdle() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace workers
|
} // namespace workers
|
||||||
|
|
Загрузка…
Ссылка в новой задаче