Skip to content

Commit

Permalink
Bug 1897589 - Simplify worker shutdown checks. r=jstutte,dom-worker-r…
Browse files Browse the repository at this point in the history
…eviewers

Differential Revision: https://phabricator.services.mozilla.com/D214740
  • Loading branch information
emilio committed Jun 27, 2024
1 parent 1b2d7d2 commit 69e561b
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions dom/workers/RuntimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2205,19 +2205,15 @@ WorkerThreadPrimaryRunnable::Run() {
// Check sentinels if we actually removed all global scope references.
// In case use the earlier set-aside raw pointers to not mess with the
// ref counting after the cycle collector has gone away.
if (globalScopeSentinel) {
MOZ_ASSERT(!globalScopeSentinel->IsAlive());
if (NS_WARN_IF(globalScopeSentinel->IsAlive())) {
globalScopeRawPtr->NoteWorkerTerminated();
globalScopeRawPtr = nullptr;
}
if (NS_WARN_IF(globalScopeSentinel && globalScopeSentinel->IsAlive())) {
MOZ_ASSERT_UNREACHABLE("WorkerGlobalScope alive after worker shutdown");
globalScopeRawPtr->NoteWorkerTerminated();
globalScopeRawPtr = nullptr;
}
if (debuggerScopeSentinel) {
MOZ_ASSERT(!debuggerScopeSentinel->IsAlive());
if (NS_WARN_IF(debuggerScopeSentinel->IsAlive())) {
debuggerScopeRawPtr->NoteWorkerTerminated();
debuggerScopeRawPtr = nullptr;
}
if (NS_WARN_IF(debuggerScopeSentinel && debuggerScopeSentinel->IsAlive())) {
MOZ_ASSERT_UNREACHABLE("Debugger global alive after worker shutdown");
debuggerScopeRawPtr->NoteWorkerTerminated();
debuggerScopeRawPtr = nullptr;
}
}

Expand Down

0 comments on commit 69e561b

Please sign in to comment.