| 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();
|
| }
|
|
|