Skip to content
Snippets Groups Projects
Commit ba67afcf authored by Ben Kelly's avatar Ben Kelly
Browse files

Bug 1290116 P1 Expose a ServiceWorkerRegistrationInfo::IsIdle() method. r=asuth

parent 57ddfd4c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment