cc: Add command line switch to control resource usage for impl-side painting.

Reduce unused resource pool memory to a percentage of memory limit.

BUG=179460

Review URL: https://chromiumcodereview.appspot.com/12502016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191239 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 3b2764f..84fc082 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -859,6 +859,11 @@
     new_state.memory_limit_in_bytes = visible_ ?
                                       policy.bytes_limit_when_visible :
                                       policy.bytes_limit_when_not_visible;
+    // TODO(reveman): We should avoid keeping around unused resources if
+    // possible. crbug.com/224475
+    new_state.unused_memory_limit_in_bytes =
+        (new_state.memory_limit_in_bytes *
+         settings_.max_unused_resource_memory_percentage) / 100;
     new_state.memory_limit_policy =
         ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
             visible_ ?