Closed Bug 1746750 Opened 3 years ago Closed 3 years ago

Implement partial OffscreenCanvasRenderingContext2D for main and worker threads

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: aosmond, Assigned: aosmond, NeedInfo)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(4 files)

Many test cases and applications seem to assume both. This is worth providing even a partial implementation just to provide test coverage.

This bug tracks putting together an initial implementation with the caveat that text rendering may be missing or suboptimal given its complexity.

It appears for fonts, we need more than just OffscreenCanvasRenderingContext2D. FontFace, etc are expected to be usable on a worker thread.

Depends on: 1072107
No longer depends on: 1072107
Blocks: 1746962
Summary: Implement OffscreenCanvasRenderingContext2D for main and worker threads → Implement partial OffscreenCanvasRenderingContext2D for main and worker threads

This patch is a non-functional change which allows the shutdown observer
to be overridden (since workers have a different mechanism). It also
fixes a static counter to be atomic, and adds mOffscreenCanvas to the
cycle collection tracking.

This patch is a non-functional change. It overloads some WebIDL methods
of CanvasRenderingContext2D to account for the difference between the
main thread and worker prototypes.

Depends on D135352

This patch adds a partial OffscreenCanvasRenderingContext2D
implementation. It is missing anything text and UI related, including
CanvasFilters, CanvasUserInterface, CanvasText, CanvasTextDrawingStyles,
and CanvasHitRegions.

Depends on D135353

Blocks: 1751721
Attachment #9258043 - Attachment description: WIP: Bug 1746750 - Part 1. Refactoring to support OffscreenCanvasRenderingContext2D. → Bug 1746750 - Part 1. Refactoring to support OffscreenCanvasRenderingContext2D.
Attachment #9258044 - Attachment description: WIP: Bug 1746750 - Part 2. Add new WebIDL method variants to support OffscreenCanvasRenderingContext2D. → Bug 1746750 - Part 2. Add new WebIDL method variants to support OffscreenCanvasRenderingContext2D.
Attachment #9258045 - Attachment description: WIP: Bug 1746750 - Part 3. Implement partial OffscreenCanvasRenderingContext2D. → Bug 1746750 - Part 3. Implement partial OffscreenCanvasRenderingContext2D.
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/36fedb339908 Part 1. Refactoring to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/cccf6afc3ce9 Part 2. Add new WebIDL method variants to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/9c2aca08a507 Part 3. Implement partial OffscreenCanvasRenderingContext2D. r=lsalzman,webidl,smaug https://hg.mozilla.org/integration/autoland/rev/011f75653bfb Part 4. Update test annotations for OffscreenCanvasRenderingContext2D. r=lsalzman

Backed out for causing mochitest webgl failures on test_2_conformance2__offscreencanvas__offscreencanvas-sync.html.
Later, more failures appeared:
This linux build bustage
This wpt failures
and This Windows MinGW all build bustages

Push with failures

Failure log

Backout link

[task 2022-02-02T21:17:25.382Z] 21:17:25     INFO - TEST-START | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-sync.html
[task 2022-02-02T21:17:29.020Z] 21:17:29     INFO - GECKO(1326) | 2022-02-02 21:17:29.019 firefox[1326:15595] Persistent UI failed to open file file:///Users/cltbld/Library/Saved%20Application%20State/org.mozilla.nightly.savedState/window_1.data: No such file or directory (2)
[task 2022-02-02T21:22:45.630Z] 21:22:45     INFO - TEST-INFO | started process screencapture
[task 2022-02-02T21:22:45.749Z] 21:22:45     INFO - TEST-INFO | screencapture: exit 0
[task 2022-02-02T21:22:45.749Z] 21:22:45     INFO - Buffered messages logged at 21:17:25
[task 2022-02-02T21:22:45.750Z] 21:22:45     INFO - TEST-PASS | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-sync.html | A valid string reason is expected 
[task 2022-02-02T21:22:45.750Z] 21:22:45     INFO - TEST-PASS | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-sync.html | Reason cannot be empty 
[task 2022-02-02T21:22:45.750Z] 21:22:45     INFO - Buffered messages finished
[task 2022-02-02T21:22:45.751Z] 21:22:45     INFO - TEST-UNEXPECTED-FAIL | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-sync.html | Test timed out. - 
[task 2022-02-02T21:22:46.633Z] 21:22:46     INFO - GECKO(1326) | MEMORY STAT | vsize 6608MB | residentFast 98MB | heapAllocated 11MB
[task 2022-02-02T21:22:46.638Z] 21:22:46     INFO - TEST-OK | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-sync.html | took 321256ms
[task 2022-02-02T21:22:46.647Z] 21:22:46     INFO - TEST-START | dom/canvas/test/webgl-conf/generated/test_2_conformance2__offscreencanvas__offscreencanvas-timer-query.html
Flags: needinfo?(aosmond)

Single failing test on OSX opt (not debug interestingly) due to timeout, nothing interesting in the log to help me debug this. I'll mark it as failing and reland.

Flags: needinfo?(aosmond)
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4a3da2db3bc0 Part 1. Refactoring to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/08e0ff1804f6 Part 2. Add new WebIDL method variants to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/87dde3962558 Part 3. Implement partial OffscreenCanvasRenderingContext2D. r=lsalzman,webidl,smaug https://hg.mozilla.org/integration/autoland/rev/bf79a6b72d87 Part 4. Update test annotations for OffscreenCanvasRenderingContext2D. r=lsalzman

Backed out as per Andrew's request.
Also please check again the comment no. 8 for more info about the previous backout.

Backout link

Flags: needinfo?(aosmond)
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b43727bd95d6 Part 1. Refactoring to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/3e808ae032db Part 2. Add new WebIDL method variants to support OffscreenCanvasRenderingContext2D. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/9712b727646f Part 3. Implement partial OffscreenCanvasRenderingContext2D. r=lsalzman,webidl,smaug https://hg.mozilla.org/integration/autoland/rev/428fb86f9ff1 Part 4. Update test annotations for OffscreenCanvasRenderingContext2D. r=lsalzman
Regressions: 1753317
Regressions: 1753573
Regressions: 1753657
Regressions: 1753270
No longer blocks: 1746962
Blocks: 1746110
Regressions: 1757757
Regressions: 1769910

The docs for this can be tracked in https://github.com/mdn/content/issues/18772

Bug fix says "partial implementation". What is implemented in OffscreenCanvasRenderingContext2D - is it exactly the same methods/properties as CanvasRenderingContext2D?

Flags: needinfo?(aosmond)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: