Closed Bug 1797327 Opened 2 years ago Closed 2 years ago

Rework how WorkerLoadContext is held on the main thread

Categories

(Core :: DOM: Workers, task)

task

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: yulia, Assigned: yulia)

References

Details

Attachments

(2 files)

This is a cleanup following up from moving to ScriptLoadRequestList. We can't hold on to requests directly, but we can use WorkerLoadContexts as a handle, and do that in a cleaner way then we currently have it.

In order to use the WorkerLoadContext as a handle for ScriptLoadRequests in the main thread portion
of worker loading, we need to make it thread safe. Which means, it cannot be CC'd, and we need to
manually break cycles. This patch does the first portion of this work, which is inroduce two new
loadContextBase classes, that are either cc'd or not cc'd. For the DOM and mozJSComponent loader, we
continue to use a CC'd LoadContextBase. Workers however now have a non-cc'd variant.

Assignee: nobody → ystartsev
Status: NEW → ASSIGNED

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.

Depends on D160333

Pushed by ystartsev@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7ade701781f5 Introduce CC'd and non CC'd variants of LoadContextBase; r=jonco https://hg.mozilla.org/integration/autoland/rev/5f483f0b842a Use RefPtrs for all WorkerLoadContexts; r=asuth
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
Regressions: 1798610
Blocks: 1794249
Blocks: 1793407
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: