Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1944)

Unified Diff: cc/output/gl_renderer.cc

Issue 2278283003: Refactor client visibility handling (Closed)
Patch Set: fix compositor_unittests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index fb1ee183c2a86feaffa6e4c294cb047b98c25384..0d7732a016926da3282f020dd10af42d5edcfd23 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -418,6 +418,12 @@ GLRenderer::~GLRenderer() {
}
CleanupSharedObjects();
+
+ if (context_visibility_) {
+ output_surface_->context_provider()
danakj 2016/08/26 23:49:08 nit: maybe auto* cache_controller = outsur->conpr
ericrk 2016/08/29 22:43:22 Sadly, that first line is more than 80 chars... bu
danakj 2016/08/29 23:56:20 Eh, 3 lines for 3 lines with more text I guess.
+ ->CacheController()
+ ->ClientBecameNotVisible(std::move(context_visibility_));
+ }
}
const RendererCapabilitiesImpl& GLRenderer::Capabilities() const {
@@ -440,15 +446,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);
+ if (visible_ && !context_visibility_) {
danakj 2016/08/26 23:49:08 Can you actually become visible and have a context
ericrk 2016/08/29 22:43:22 Yeah, this seems reasonable.
+ context_visibility_ = output_surface_->context_provider()
danakj 2016/08/26 23:49:08 similars for formatting?
ericrk 2016/08/29 22:43:22 Refactored.
+ ->CacheController()
+ ->ClientBecameVisible();
+ } else if (!visible_ && context_visibility_) {
+ output_surface_->context_provider()
+ ->CacheController()
+ ->ClientBecameNotVisible(std::move(context_visibility_));
+ }
}
void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); }

Powered by Google App Engine
This is Rietveld 408576698