Do not give GPU memory to backgrounded compositors.
This has already been disabled on all platforms except Windows and
Chrome OS to be more conservative about GPU memory.
All platforms are moving to a delegated renderer where, if keeping
around resources for a fast tab-switch is desired, it can be
accomplished by not releasing those resources in the browser process.
This feature was originally requested in crbug.com/134750.
Also remove the infrastructure for preserving backbuffers of
backgrounded renderers. This feature was never enabled.
BUG=276559
Review URL: https://codereview.chromium.org/53633003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232324 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 7171580..0b71c84 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -208,8 +208,6 @@
cached_managed_memory_policy_(
PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING,
- 0,
- gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING,
ManagedMemoryPolicy::kDefaultNumResourcesLimit),
pinch_gesture_active_(false),
pinch_gesture_end_should_clear_scrolling_layer_(false),
@@ -1066,11 +1064,10 @@
const ManagedMemoryPolicy& policy) {
bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread(
- visible_ ? policy.bytes_limit_when_visible
- : policy.bytes_limit_when_not_visible,
+ visible_ ? policy.bytes_limit_when_visible : 0,
ManagedMemoryPolicy::PriorityCutoffToValue(
visible_ ? policy.priority_cutoff_when_visible
- : policy.priority_cutoff_when_not_visible));
+ : gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING));
if (evicted_resources) {
active_tree_->SetContentsTexturesPurged();
if (pending_tree_)
@@ -1093,8 +1090,7 @@
// possible. crbug.com/224475
global_tile_state_.memory_limit_in_bytes =
visible_ ?
- policy.bytes_limit_when_visible :
- policy.bytes_limit_when_not_visible;
+ policy.bytes_limit_when_visible : 0;
global_tile_state_.unused_memory_limit_in_bytes = static_cast<size_t>(
(static_cast<int64>(global_tile_state_.memory_limit_in_bytes) *
settings_.max_unused_resource_memory_percentage) / 100);
@@ -1102,7 +1098,7 @@
ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
visible_ ?
policy.priority_cutoff_when_visible :
- policy.priority_cutoff_when_not_visible);
+ gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
global_tile_state_.num_resources_limit = policy.num_resources_limit;
DidModifyTilePriorities();
@@ -1131,11 +1127,6 @@
SetManagedMemoryPolicy(policy, zero_budget_);
}
-void LayerTreeHostImpl::SetDiscardBackBufferWhenNotVisible(bool discard) {
- DCHECK(renderer_);
- renderer_->SetDiscardBackBufferWhenNotVisible(discard);
-}
-
void LayerTreeHostImpl::SetTreeActivationCallback(
const base::Closure& callback) {
DCHECK(proxy_->IsImplThread());
@@ -1560,15 +1551,12 @@
ManagedMemoryPolicy LayerTreeHostImpl::ActualManagedMemoryPolicy() const {
ManagedMemoryPolicy actual = cached_managed_memory_policy_;
if (debug_state_.rasterize_only_visible_content) {
- actual.priority_cutoff_when_not_visible =
- gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING;
actual.priority_cutoff_when_visible =
gpu::MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY;
}
if (zero_budget_) {
actual.bytes_limit_when_visible = 0;
- actual.bytes_limit_when_not_visible = 0;
}
return actual;