Flush after LTHI::ReclaimResources when hidden.
In ReclaimResources we return resources from the parent, which usually end up
deleted when we're invisible (since our allocation is supposed to be 0). In that
case we want to make sure that we flush the context so that the textures are
actually deleted in the GPU process (and free up memory for the rest of the
system).
BUG=349553
Review URL: https://codereview.chromium.org/229893003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262668 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 685cfb99..96d05363 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1309,6 +1309,11 @@
tile_manager_->resource_pool()->CheckBusyResources();
tile_manager_->resource_pool()->ReduceResourceUsage();
}
+ // If we're not visible, we likely released resources, so we want to
+ // aggressively flush here to make sure those DeleteTextures make it to the
+ // GPU process to free up the memory.
+ if (resource_provider_ && !visible_)
+ resource_provider_->ShallowFlushIfSupported();
}
void LayerTreeHostImpl::OnCanDrawStateChangedForTree() {