Closed Bug 1870957 Opened 10 months ago Closed 10 months ago

Minor refactoring needed for recording on DOM workers

Categories

(Core :: Graphics: Canvas2D, task, P3)

task

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

Attachments

(4 files)

This bug is taking a few parts of bug 1855742 that can land separately and are fairly benign. Let's try to get what we can in the tree to avoid future mega backouts.

This patch adds/updates the thread assertion plumbing for CanvasChild
and DrawEventRecorder to ensure that we are always accessing them on the
owning thread. It also now makes these checks compatible with running in
a DOM worker context for OffscreenCanvas using recordings.

This patch allows us to create nsExpirationTracker objects off the main
thread, with the caveat that memory pressure events should/must be
handled directly by the creator rather than managed internally. With
that in mind, the threading assertions have also been updated to ensure
it is always the owning thread that accesses the tracker.

This patch makes the CanvasManagerChild creates/manager the
ActiveResourceTracker instead of the WebRenderBridgeChild. Since PCanvas
is now managed by PCanvasManager, and ActiveResourceTracker is only used
by the PCanvas recording plumbing, we need it on every thread that the
CanvasManagerChild can be created.

Because we cannot control the ordering of shutdown notification from
WorkerRef, we need to choose one centralized point to begin shutdown of
the main thread or the owning DOM worker. Since there are other objects
owned by CanvasManagerChild, we also switch to a ThreadSafeWorkerRef.

Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1cf19c5cfffc Part 1. Add/update owning thread assertions to CanvasChild/DrawEventRecorder. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/14502db5fd83 Part 2. Allow nsExpirationTracker to be created on any thread. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/54b34db748e7 Part 3. Make CanvasManagerChild manage ActiveResourceTracker. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/a25ceb17af22 Part 4. Refactor canvas shutdown to be synchronized with CanvasManagerChild. r=lsalzman
Regressions: 1886022
Regressions: 1882573
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: