diff options
author | boliu <boliu@chromium.org> | 2015-06-11 13:01:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-11 20:03:07 +0000 |
commit | 3d442d362ddec4594dc12983d88bdbe24f1c361c (patch) | |
tree | 04d576cc5b0211a08d3cf4855e37249a375bf40e | |
parent | aaebd113a77b1a7f7a589e1c7a0884389b8eb19e (diff) | |
download | chromium_src-3d442d362ddec4594dc12983d88bdbe24f1c361c.zip chromium_src-3d442d362ddec4594dc12983d88bdbe24f1c361c.tar.gz chromium_src-3d442d362ddec4594dc12983d88bdbe24f1c361c.tar.bz2 |
Synchronously drop tile textures in android webview
Merely applying zero memory is not enough to synchronously drop all tile
textures. Instead destroy and recreate TileManager instead.
BUG=496057, 499004
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1176713002
Cr-Commit-Position: refs/heads/master@{#334020}
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 6446bdb..2ef7bef 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1327,6 +1327,20 @@ void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { SetManagedMemoryPolicy(policy); + + // This is short term solution to synchronously drop tile resources when + // using synchronous compositing to avoid memory usage regression. + // TODO(boliu): crbug.com/499004 to track removing this. + if (!policy.bytes_limit_when_visible && tile_manager_ && + settings_.using_synchronous_renderer_compositor) { + ReleaseTreeResources(); + // TileManager destruction will synchronoulsy wait for all tile workers to + // be cancelled or completed. This allows all resources to be freed + // synchronously. + DestroyTileManager(); + CreateAndSetTileManager(); + RecreateTreeResources(); + } } void LayerTreeHostImpl::SetTreeActivationCallback( |