Open Bug 1836700 Opened 2 years ago Updated 1 year ago

Eliminate busy count tracking from WorkerRunnables

Categories

(Core :: DOM: Workers, enhancement)

enhancement

Tracking

()

People

(Reporter: asuth, Assigned: edenchuang)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Eliminate busy count tracking in favor of just letting WorkerRefs, the existence of IPC actors, and (newly proposed) the presence of events in our main-thread ThrottledEventQueues/worker debugee queues keep a worker alive. This enables a simplification of the WorkerRunnable implementation. This is a spin-off follow-up from bug 1800659 which going to originally address this (but which quite reasonably was de-scoped).

One particular benefit is there is no need for runnables sent to the main thread to have a reference to the WorkerPrivate (to update the busy count), however it's likely that we would want to approximate the original design behavior by having the GC traversal logic in WorkerPrivate::Traverse that Worker::Traverse calls into:

  • Check if there are any runnables in our mMainThreadDebuggeeEventTarget main thread-targeted ThrottledEventQueue. This is a new proposal with the filing of this bug, but an easy thing for us to check that could potentially allow us to continue to GC in more cases.
  • We also would like to be aware of runnables resulting from Worker.postMessage; most practically having any runnables in the queue would be sufficient but would err on the side of GCing less.
  • Check if there are StrongWorkerRefs. (IPCWorkerRefs would continue to not prevent GC, as would also be the case for WeakWorkerRefs.)
Blocks: 1769913
Assignee: nobody → echuang

I have some local patches for this, so I take this bug.

Blocks: 1805613
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: