Make 2D contexts discardable with OffscreenCanvas #2303
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
normative change
topic: canvas
WebGL has a reasonable model that allows for contexts to be released and rebuilt, which allows, among other things, for GPU resources to be released when a page is in the background. This is implemented via the webglcontextlost and webglcontextrestored events.
The issue has been raised in the past that 2D contexts should have the same feature. However, it is not clear how this could be achieved in a backwards-compatible way. One suggestion was to make 2D contexts discardable only if an event listener is registered on the contextLost event. That idea was discarded because the registration of an event listener is not allowed to have side-effects.
With OffscreenCanvas, we have a clean slate. There is no legacy content to break. Therefore, we could use this opportunity to add the contextLost/restored events to OffscreenCanvases with 2D contexts.
The text was updated successfully, but these errors were encountered: