Bug 1465294 Part 16 - Support web workers when recording/replaying, r=smaug.
This commit is contained in:
@@ -576,6 +576,13 @@ InterruptCallback(JSContext* aCx)
|
|||||||
WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
|
WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
|
||||||
MOZ_ASSERT(worker);
|
MOZ_ASSERT(worker);
|
||||||
|
|
||||||
|
// As with the main thread, the interrupt callback is triggered
|
||||||
|
// non-deterministically when recording/replaying, so return early to avoid
|
||||||
|
// performing any recorded events.
|
||||||
|
if (recordreplay::IsRecordingOrReplaying()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Now is a good time to turn on profiling if it's pending.
|
// Now is a good time to turn on profiling if it's pending.
|
||||||
PROFILER_JS_INTERRUPT_CALLBACK();
|
PROFILER_JS_INTERRUPT_CALLBACK();
|
||||||
|
|
||||||
@@ -965,6 +972,11 @@ public:
|
|||||||
NS_WARNING("failed to set workerCx's default locale");
|
NS_WARNING("failed to set workerCx's default locale");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cycle collections must occur at consistent points when recording/replaying.
|
||||||
|
if (recordreplay::IsRecordingOrReplaying()) {
|
||||||
|
recordreplay::RegisterTrigger(this, [=]() { nsCycleCollector_collect(nullptr); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown(JSContext* cx) override
|
void Shutdown(JSContext* cx) override
|
||||||
@@ -979,6 +991,10 @@ public:
|
|||||||
~WorkerJSRuntime()
|
~WorkerJSRuntime()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR_INHERITED(WorkerJSRuntime, CycleCollectedJSRuntime);
|
MOZ_COUNT_DTOR_INHERITED(WorkerJSRuntime, CycleCollectedJSRuntime);
|
||||||
|
|
||||||
|
if (recordreplay::IsRecordingOrReplaying()) {
|
||||||
|
recordreplay::UnregisterTrigger(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
@@ -1015,9 +1031,13 @@ public:
|
|||||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||||
|
|
||||||
if (aStatus == JSGC_END) {
|
if (aStatus == JSGC_END) {
|
||||||
|
if (recordreplay::IsRecordingOrReplaying()) {
|
||||||
|
recordreplay::ActivateTrigger(this);
|
||||||
|
} else {
|
||||||
nsCycleCollector_collect(nullptr);
|
nsCycleCollector_collect(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WorkerPrivate* mWorkerPrivate;
|
WorkerPrivate* mWorkerPrivate;
|
||||||
|
|||||||
Reference in New Issue
Block a user