Bug 1522246 - Shutdown workers immediately after terminate()ing them, r=asuth.

--HG--
extra : rebase_source : e4104b82f26fc80241b2d0f4f1bd096053ff9a5e
This commit is contained in:
Brian Hackett 2019-02-12 14:11:59 -10:00
Родитель dab1997eb6
Коммит d97c2ee757
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -2572,9 +2572,15 @@ void WorkerPrivate::DoRunLoop(JSContext* aCx) {
{
MutexAutoLock lock(mMutex);
// Wait for a runnable to arrive that we can execute, or for it to be okay
// to shutdown this worker once all holders have been removed.
// Holders may be removed from inside normal runnables, but we don't check
// for that after processing normal runnables, so we need to let control
// flow to the shutdown logic without blocking.
while (mControlQueue.IsEmpty() &&
!(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) &&
!(normalRunnablesPending = NS_HasPendingEvents(mThread))) {
!(normalRunnablesPending = NS_HasPendingEvents(mThread)) &&
!(mStatus != Running && !HasActiveHolders())) {
WaitForWorkerEvents();
}