New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 610350 link

Starred by 5 users

Issue metadata

Status: Archived
Owner:
Last visit > 30 days ago
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 776801



Sign in to add a comment

Eagerly release graphics resources for OffscreenCanvas

Project Member Reported by xidac...@chromium.org, May 9 2016

Issue description

In the case of an HTMLCanvasElement, when a page's visibility changes (e.g. navigating away from the current page), graphics resources will be release when the page is hidden. This is implemented in the function:

HTMLCanvasElement::pageVisibilityChanged()

In the case of OffscreenCanvas, we should also release graphics resources if the current page is hidden.
 

Comment 1 by kbr@chromium.org, May 9 2016

It's confusing that a notification called "pageVisibilityChanged" from PageLifecycleObserver controls this behavior. If that has anything to do with whether a tab is in the foreground or background, it's not a good place to drop graphics resources. At least, for WebGL, it would have a side-effect visible to the application.

To clarify, for OffscreenCanvas, graphics resources should be released eagerly if:
 1. It's being used on a worker and the worker is shut down
 2. It's being used on the main thread and a page navigation or reload happens (similar to HTMLCanvasElement)
 3. Probably other cases.

It looks like this is currently handled in HTMLCanvasElement::contextDestroyed(), and should also be for OffscreenCanvas.

Comment 2 by junov@chromium.org, May 10 2016

To be clear, what should happen when visibility changes is that we should release transient resources: 2D canvas flushes its display list, goes back to being single buffered, may go into hibernation (backing store swapped out of GPU mem). These clean-ups have no side-effects WRT content behavior.

Comment 3 by kbr@chromium.org, May 10 2016

OK. For the WebGL rendering context, there's probably not much that should be done upon backgrounding a tab. On the other hand, WebGL resources should be released eagerly upon JavaScript context termination.
Owner: ----
Status: Available (was: Assigned)
Project Member

Comment 5 by sheriffbot@chromium.org, Nov 29 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by kbr@chromium.org, Nov 29 2017

Labels: -Hotlist-Recharge-Cold
Status: Available (was: Untriaged)

Comment 7 by xlai@chromium.org, Dec 1 2017

Blockedon: 776801
Cc: -xlai@chromium.org
Owner: xlai@chromium.org
Status: Assigned (was: Available)
Will put it under my name first; but anyone who wants to work on it can take it.

I think it might be better to start this job after finishing the refactoring on offscreen canvas resource provider.

Comment 8 by xlai@chromium.org, May 7 2018

Status: Archived (was: Assigned)
I took a second look on this task and found its requirement very confusing: Shouldn't visibility change a behavior that's specific to an HTML element instead of OffscreenCanvas (which is an "off screen" thing that is not visible)? Then why must visibility change affect OffscreenCanvas's graphics management?

Regarding to kbr@'s comment about "when worker shuts down, resources need to be release", the current CanvasResourceProvider is a unique pointer to OffscreenCanvas; the latter's destructor will automatically cleans up the resources and that's not a concern.

I took a hectic move in putting this issue to "archived" status; please revive it if my understanding is wrong.

Sign in to add a comment