Bug 1797327 - Use RefPtrs for all WorkerLoadContexts; r=asuth

As WorkerLoadContexts now inherit from a non-CC'd loadContextBase, we have two outcomes.
1) we need to break cycles with ScriptLoadRequests manually, so that ScriptLoadRequests can be collected (ScriptLoadRequests must be CC'd).
2) we can now have refptrs to WorkerLoadContexts in the CacheLoadHandler and NetworkLoadHandler classes, and remove any remaining raw pointers to ScriptLoadRequest/WorkerLoadContext. There are cases where the NetworkLoadHandler or CacheLoadHandler might outlive the Worker Loader, so having refpointers here should help us recover in those cases.

Differential Revision: https://phabricator.services.mozilla.com/D160334
This commit is contained in:
Yulia Startsev
2022-11-01 18:03:34 +00:00
parent 541556234b
commit ce1a0e170d
11 changed files with 89 additions and 35 deletions

View File

@@ -305,13 +305,15 @@ class ScriptLoadRequest
void DropBytecodeCacheReferences();
bool HasLoadContext() const { return mLoadContext; }
bool HasScriptLoadContext() const;
bool HasWorkerLoadContext() const;
mozilla::dom::ScriptLoadContext* GetScriptLoadContext();
mozilla::loader::ComponentLoadContext* GetComponentLoadContext();
mozilla::dom::WorkerLoadContext* GetWorkerLoadContext();
already_AddRefed<mozilla::dom::WorkerLoadContext> StealWorkerLoadContext();
const ScriptKind mKind; // Whether this is a classic script or a module
// script.