Bug 1637890 - P3. Ensure an AbstractThread exists when dispatching a task. r=froydnj

When performing the last GC, remaining state watchers would dispatch direct tasks ; this was exposed with P3. Ensure this never happens.

Differential Revision: https://phabricator.services.mozilla.com/D75499
This commit is contained in:
Jean-Yves Avenard 2020-05-18 02:30:27 +00:00
Родитель de5872ee7a
Коммит 906437cc5d
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -262,6 +262,7 @@ void AbstractThread::ShutdownMainThread() {
void AbstractThread::DispatchStateChange(
already_AddRefed<nsIRunnable> aRunnable) {
AbstractThread* currentThread = GetCurrent();
MOZ_DIAGNOSTIC_ASSERT(currentThread, "An AbstractThread must exist");
if (currentThread->IsTailDispatcherAvailable()) {
currentThread->TailDispatcher().AddStateChangeTask(this,
std::move(aRunnable));
@ -280,6 +281,7 @@ void AbstractThread::DispatchStateChange(
void AbstractThread::DispatchDirectTask(
already_AddRefed<nsIRunnable> aRunnable) {
AbstractThread* currentThread = GetCurrent();
MOZ_DIAGNOSTIC_ASSERT(currentThread, "An AbstractThread must exist");
if (currentThread->IsTailDispatcherAvailable()) {
currentThread->TailDispatcher().AddDirectTask(std::move(aRunnable));
} else {