Open Bug 1263215 Opened 8 years ago Updated 2 years ago

refactor WorkerRunnable::Dispatch() scheme so runnable object always releases on target worker thread

Categories

(Core :: DOM: Workers, task, P3)

task

Tracking

()

Tracking Status
firefox48 --- affected

People

(Reporter: bkelly, Unassigned)

References

Details

Currently the WorkerRunnable::Dispatch() method is designed such that the dispatching thread always holds a ref after the dispatch.  This makes it racy as to which thread will actually finally release the runnable object.

In order to fix this we would have to replace WorkerRunnable::PostDispatch() with something else.  Right now there are no PostDispatch() method impls that significantly use any runnable state.  So we could probably remove it and replace it with a behavior object thats used only on the dispatching thread.

Another alternative would be to create an explicit "ReleaseWorkerThreadObjects()" method on WorkerRunnable that implementing classes could override.

I think it would be nicer to fix the race if we can since it adds to the overall complexity of writing code for workers.
See Also: → 1259338
Whiteboard: btpp-fixlater
Priority: -- → P2
Whiteboard: btpp-fixlater
Priority: P2 → P3

:asuth, is this still something we want to do?

Type: defect → task
Flags: needinfo?(bugmail)

(In reply to Ben Kelly [:bkelly, not reviewing] from comment #0)

Right now there are no PostDispatch() method impls that significantly use any runnable state. So we could probably remove it and replace it with a behavior object thats used only on the dispatching thread.

Looking at searchfox I actually find only few PostDispatch that do something more than just assert and only one that accesses inner state, so I guess the claim "there are no impls that significantly use any runnable state" still holds.

This still makes sense to do.

Flags: needinfo?(bugmail)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.