Use a timer to drop free canvas buffers when a CanvasChild is dormant
Categories
(Core :: Graphics, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: aosmond, Assigned: aosmond)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
CanvasChild::EndTransaction schedules DropFreeBuffersWhenDormant with NS_DelayedDispatchToCurrentThread when there have been no non-empty transactions. That only works on the main thread: on a DOM worker, WorkerEventTarget::DelayedDispatch returns NS_ERROR_NOT_IMPLEMENTED, so the dormant cleanup never runs and the runnable (which holds a reference to the CanvasChild) is leaked.
Today a CanvasChild is only created on the main thread, because OffscreenCanvas on a worker cannot get one through ImageBridgeChild, so this is not reachable yet. It will be once accelerated OffscreenCanvas 2D is enabled on DOM workers.
Proposed fix: use a one-shot nsITimer on the current serial event target instead, which works on both the main thread and DOM workers, and cancel it in ~CanvasChild, since the callback no longer holds a reference to the CanvasChild. Main thread behaviour is unchanged.
| Assignee | ||
Comment 1•3 days ago
|
||
DOM workers do not support delayed dispatch, which would fail and leak the
runnable.
Comment 3•3 days ago
|
||
| bugherder | ||
Description
•