Skip to content

Commit

Permalink
Do not try to evict invalid surface ID
Browse files Browse the repository at this point in the history
There is a timing where CollectSurfaceIdsForEviction can be called when
surfaces have already been evicted. In this case, the evicted surface
IDs will have been marked as invalid. Existing code for the embedded
client checks if the surface IDs are valid before returning them for
eviction, but for native occlusion the ui compositor window's surface
ID is not checked.

This CL adds the same check for the ui compositor window's surface ID.

Bug: 328935971
Test: local testing + CQ
Change-Id: I976e0043f521d8dcdcff46438b5f44896c041a85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5364183
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Auto-Submit: Eliot Courtney <edcourtney@chromium.org>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1272107}
  • Loading branch information
Eliot Courtney authored and Chromium LUCI CQ committed Mar 13, 2024
1 parent 323c56a commit bc9ea55
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -71,10 +71,16 @@ DelegatedFrameHostClientAura::CollectSurfaceIdsForEviction() {
auto ids = render_widget_host_view_->host()->CollectSurfaceIdsForEviction();

// If the ui compositor is no longer visible, include its surface ID for
// eviction as well.
// eviction as well. The surface ID may be invalid if we already evicted the
// ui compositor. This can happen, for example, if we have multiple tabs that
// were unlocked frames (not visible but not evicted) for the same ui
// compositor which is now not visible, and we evict them. If the surface ID
// is invalid, it means we already evicted the ui compositor so it is safe to
// skip doing it again.
auto* host = render_widget_host_view_->window()->GetHost();
if (DelegatedFrameHost::ShouldIncludeUiCompositorForEviction() && host &&
!host->compositor()->IsVisible()) {
!host->compositor()->IsVisible() &&
host->window()->GetSurfaceId().is_valid()) {
ids.push_back(host->window()->GetSurfaceId());
}
return ids;
Expand Down

0 comments on commit bc9ea55

Please sign in to comment.