Bug 1821250 - Use a timer on debugger control runnable to ensure running them even if worker uses Atomics.wait. r=asuth

Atomics.wait prevent WorkerDebuggerRunnable's from running by blocking the event loop.
While dispatching these runnables, also spawn a short timer which would interrupt the worker
and tentatively try to drain the debugger queue and resume any debugger runnable which may be blocked.

Differential Revision: https://phabricator.services.mozilla.com/D194081
This commit is contained in:
Alexandre Poirot
2024-02-14 17:18:44 +00:00
parent 5e312986f0
commit aa44b4dd66
3 changed files with 119 additions and 47 deletions

View File

@@ -449,14 +449,14 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
}
}
bool InterruptCallback(JSContext* aCx) {
MOZ_CAN_RUN_SCRIPT bool InterruptCallback(JSContext* aCx) {
WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(worker);
// Now is a good time to turn on profiling if it's pending.
PROFILER_JS_INTERRUPT_CALLBACK();
return worker->InterruptCallback(aCx);
return MOZ_KnownLive(worker)->InterruptCallback(aCx);
}
class LogViolationDetailsRunnable final : public WorkerMainThreadRunnable {