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

This commit is contained in:
Ben Kelly 2016-08-18 07:12:08 -07:00
Родитель da1166fba2
Коммит 20caf371e2
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -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