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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 2869513002: cc: Clear checker-image tracking on navigation and visibility changes. (Closed)
Patch Set: missed pending invalidations Created 3 years, 7 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
« cc/tiles/checker_image_tracker.cc ('K') | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index b8d25afce74bc79b87f99037202737c75b5e928c..a5d7d77ef63c0b816e9b4a61dd34fccb667bd434 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1280,6 +1280,14 @@ void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
// running work.
if (image_decode_cache_)
image_decode_cache_->SetShouldAggressivelyFreeResources(false);
+ } else {
+ // When the memory policy is set to zero, its important to release any
+ // decoded images cached by the tracker. But we can not re-checker any
+ // images that have been displayed since the resources, if held by the
+ // browser, may be re-used. Which is why its important to maintain the
+ // decode policy tracking.
+ bool can_clear_decode_policy_tracking = false;
+ tile_manager_.ClearCheckerImageTracking(can_clear_decode_policy_tracking);
}
DCHECK(resource_pool_);
@@ -2339,6 +2347,10 @@ LayerTreeHostImpl::TakeCompletedImageDecodeCallbacks() {
}
void LayerTreeHostImpl::ClearImageCacheOnNavigation() {
+ // It is safe to clear the decode policy tracking on navigations since it
+ // comes with an invalidation and the image ids are never re-used.
+ bool can_clear_decode_policy_tracking = true;
+ tile_manager_.ClearCheckerImageTracking(can_clear_decode_policy_tracking);
if (image_decode_cache_)
image_decode_cache_->ClearCache();
}
« cc/tiles/checker_image_tracker.cc ('K') | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698