Bug 1842798 - Part 2: Remove use of MozPromise to wait for module imports to load r=smaug

This replaces the use of a promise to wait for all imports of a module to load
with a counter of reminaing imports in the parent and a pointer to the parent
that is waiting in the child. The parent request is updated immediately rather
than by dispatching a runnable.

Differential Revision: https://phabricator.services.mozilla.com/D183273
This commit is contained in:
Jon Coppeard
2023-07-17 12:44:18 +00:00
parent a688307c43
commit dd9d0a3ed7
5 changed files with 79 additions and 47 deletions

View File

@@ -1210,6 +1210,13 @@ bool WorkerScriptLoader::EvaluateScript(JSContext* aCx,
}
void WorkerScriptLoader::TryShutdown() {
{
MutexAutoLock lock(CleanUpLock());
if (CleanedUp()) {
return;
}
}
if (AllScriptsExecuted() && AllModuleRequestsLoaded()) {
ShutdownScriptLoader(!mExecutionAborted, mMutedErrorFlag);
}