mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 1290116 P1 Expose a ServiceWorkerRegistrationInfo::IsIdle() method. r=asuth
This commit is contained in:
parent
57ddfd4c42
commit
ba67afcfb9
@ -223,7 +223,7 @@ ServiceWorkerRegistrationInfo::TryToActivate()
|
||||
AssertIsOnMainThread();
|
||||
bool controlling = IsControllingDocuments();
|
||||
bool skipWaiting = mWaitingWorker && mWaitingWorker->SkipWaitingFlag();
|
||||
bool idle = !mActiveWorker || mActiveWorker->WorkerPrivate()->IsIdle();
|
||||
bool idle = IsIdle();
|
||||
if (idle && (!controlling || skipWaiting)) {
|
||||
Activate();
|
||||
}
|
||||
@ -519,4 +519,10 @@ ServiceWorkerRegistrationInfo::TransitionWaitingToActive()
|
||||
WhichServiceWorker::ACTIVE_WORKER);
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerRegistrationInfo::IsIdle() const
|
||||
{
|
||||
return !mActiveWorker || mActiveWorker->WorkerPrivate()->IsIdle();
|
||||
}
|
||||
|
||||
END_WORKERS_NAMESPACE
|
||||
|
@ -171,6 +171,10 @@ public:
|
||||
// worker is updated to the Activating state.
|
||||
void
|
||||
TransitionWaitingToActive();
|
||||
|
||||
// Determine if the registration is actively performing work.
|
||||
bool
|
||||
IsIdle() const;
|
||||
};
|
||||
|
||||
} // namespace workers
|
||||
|
Loading…
Reference in New Issue
Block a user