Index: cc/output/gl_renderer.cc |
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
index 26d5272910ba96298a17bebf81bb4859592dfb10..7427d4df54e5947ccbee08c8658d3e9509576d49 100644 |
--- a/cc/output/gl_renderer.cc |
+++ b/cc/output/gl_renderer.cc |
@@ -415,6 +415,12 @@ GLRenderer::~GLRenderer() { |
} |
CleanupSharedObjects(); |
+ |
+ if (context_visibility_) { |
+ auto* context_provider = output_surface_->context_provider(); |
+ auto* cache_controller = context_provider->CacheController(); |
+ cache_controller->ClientBecameNotVisible(std::move(context_visibility_)); |
+ } |
} |
bool GLRenderer::CanPartialSwap() { |
@@ -433,15 +439,15 @@ void GLRenderer::DidChangeVisibility() { |
PrepareGeometry(NO_BINDING); |
- // Handle cleanup of resources on the ContextProvider. The compositor |
- // ContextProvider is not shared, so always pass 0 for the client_id. |
- // TODO(crbug.com/487471): Update this when we share compositor |
- // ContextProviders. |
- context_support_->SetClientVisible(0 /* client_id */, visible_); |
- bool aggressively_free_resources = !context_support_->AnyClientsVisible(); |
- if (aggressively_free_resources) |
- output_surface_->context_provider()->DeleteCachedResources(); |
- context_support_->SetAggressivelyFreeResources(aggressively_free_resources); |
+ auto* context_provider = output_surface_->context_provider(); |
+ auto* cache_controller = context_provider->CacheController(); |
+ if (visible_) { |
+ DCHECK(!context_visibility_); |
+ context_visibility_ = cache_controller->ClientBecameVisible(); |
+ } else { |
+ DCHECK(context_visibility_); |
+ cache_controller->ClientBecameNotVisible(std::move(context_visibility_)); |
+ } |
} |
void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); } |