mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1151646 - Spin the event loop one extra time to clean up all CC'd objects before worker shutdown, r=khuey.
This commit is contained in:
parent
a1dae92265
commit
f6cb233b56
@ -2762,15 +2762,18 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
#endif
|
||||
}
|
||||
|
||||
// Destroy the main context. This will unroot the main worker global and
|
||||
// GC. This is not the last JSContext (WorkerJSRuntime maintains an
|
||||
// internal JSContext).
|
||||
// Destroy the main context. This will unroot the main worker global and GC,
|
||||
// which should break all cycles that touch JS.
|
||||
JS_DestroyContext(cx);
|
||||
|
||||
// Before shutting down the cycle collector we need to do one more pass
|
||||
// through the event loop to clean up any C++ objects that need deferred
|
||||
// cleanup.
|
||||
mWorkerPrivate->ClearMainEventQueue(WorkerPrivate::WorkerRan);
|
||||
|
||||
// Now WorkerJSRuntime goes out of scope and its destructor will shut
|
||||
// down the cycle collector and destroy the final JSContext. This
|
||||
// breaks any remaining cycles and collects the C++ and JS objects
|
||||
// participating.
|
||||
// down the cycle collector. This breaks any remaining cycles and collects
|
||||
// any remaining C++ objects.
|
||||
}
|
||||
|
||||
mWorkerPrivate->SetThread(nullptr);
|
||||
|
@ -1210,6 +1210,9 @@ public:
|
||||
return mCancelAllPendingRunnables;
|
||||
}
|
||||
|
||||
void
|
||||
ClearMainEventQueue(WorkerRanOrNot aRanOrNot);
|
||||
|
||||
void
|
||||
OnProcessNextEvent(uint32_t aRecursionDepth);
|
||||
|
||||
@ -1252,9 +1255,6 @@ private:
|
||||
WorkerType aWorkerType, const nsACString& aSharedWorkerName,
|
||||
WorkerLoadInfo& aLoadInfo);
|
||||
|
||||
void
|
||||
ClearMainEventQueue(WorkerRanOrNot aRanOrNot);
|
||||
|
||||
bool
|
||||
MayContinueRunning()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user