Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 14061028: cc: Set tile manager memory policy in initializeRenderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Explicit set to USING_RELEASABLE_MEMORY Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index a465c3217e2155e9f070d671e5f873ce0d9d073b..abf7619700592df0c56b44b5ef80210ee2250d63 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -925,23 +925,29 @@ void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
}
client_->SendManagedMemoryStats();
- if (tile_manager_) {
- GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState());
- 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 = static_cast<size_t>(
- (static_cast<int64>(new_state.memory_limit_in_bytes) *
- settings_.max_unused_resource_memory_percentage) / 100);
- new_state.memory_limit_policy =
- ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
- visible_ ?
- policy.priority_cutoff_when_visible :
- policy.priority_cutoff_when_not_visible);
- tile_manager_->SetGlobalState(new_state);
- }
+ UpdateTileManagerMemoryPolicy(policy);
+}
+
+void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
+ const ManagedMemoryPolicy& policy) {
+ if (!tile_manager_)
+ return;
+
+ GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState());
+ 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 = static_cast<size_t>(
+ (static_cast<int64>(new_state.memory_limit_in_bytes) *
+ settings_.max_unused_resource_memory_percentage) / 100);
+ new_state.memory_limit_policy =
+ ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
+ visible_ ?
+ policy.priority_cutoff_when_visible :
+ policy.priority_cutoff_when_not_visible);
+ tile_manager_->SetGlobalState(new_state);
}
bool LayerTreeHostImpl::HasImplThread() const {
@@ -1376,6 +1382,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
settings_.use_color_estimator,
settings_.prediction_benchmarking,
rendering_stats_instrumentation_));
+ UpdateTileManagerMemoryPolicy(managed_memory_policy_);
}
if (output_surface->capabilities().has_parent_compositor) {
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698