Bug 1584396 - Do not assert about other thread dispatches at worker shutdown. r=dom-workers-and-storage-reviewers,ttung

Differential Revision: https://phabricator.services.mozilla.com/D78836
This commit is contained in:
Andrew Sutherland 2020-06-12 09:44:09 +00:00
Родитель 0598a2925f
Коммит 65818c219e
1 изменённых файлов: 6 добавлений и 4 удалений

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

@ -127,10 +127,12 @@ void WorkerThread::SetWorker(const WorkerThreadFriendKey& /* aKey */,
MOZ_ASSERT(mWorkerPrivate);
MOZ_ASSERT(!mAcceptingNonWorkerRunnables);
MOZ_ASSERT(!mOtherThreadsDispatchingViaEventTarget,
"XPCOM Dispatch hapenning at the same time our thread is "
"being unset! This should not be possible!");
// mOtherThreadsDispatchingViaEventTarget can still be non-zero here
// because WorkerThread::Dispatch isn't atomic so a thread initiating
// dispatch can have dispatched a runnable at this thread allowing us to
// begin shutdown before that thread gets a chance to decrement
// mOtherThreadsDispatchingViaEventTarget back to 0. So we need to wait
// for that.
while (mOtherThreadsDispatchingViaEventTarget) {
mWorkerPrivateCondVar.Wait();
}