summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBo Liu <boliu@chromium.org>2015-06-11 14:11:49 -0700
committerBo Liu <boliu@chromium.org>2015-06-11 21:12:56 +0000
commitdcf0fe2c579d3d9bd64c688d2c02e86866dcd428 (patch)
tree4b03fb93fdd545c5f793fc920669df73da3fa2f1
parent636cb2dfa0590d101bb55e2a2b2229675285964d (diff)
downloadchromium_src-dcf0fe2c579d3d9bd64c688d2c02e86866dcd428.zip
chromium_src-dcf0fe2c579d3d9bd64c688d2c02e86866dcd428.tar.gz
chromium_src-dcf0fe2c579d3d9bd64c688d2c02e86866dcd428.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} (cherry picked from commit 3d442d362ddec4594dc12983d88bdbe24f1c361c) TBR=boliu@chromium.org Review URL: https://codereview.chromium.org/1178223005. Cr-Commit-Position: refs/branch-heads/2403@{#286} Cr-Branched-From: f54b8097a9c45ed4ad308133d49f05325d6c5070-refs/heads/master@{#330231}
-rw-r--r--cc/trees/layer_tree_host_impl.cc14
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 5e02cab..ae6fcb8 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1296,6 +1296,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(