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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 11637022: Send memory management policies to the tile manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate review feedback Created 8 years 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
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 408e8417971f300adfce4cb83a855ddaf80153bc..860ab7e653415d77fdfac829d0bc2b91f7e61f8b 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -216,9 +216,9 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
, m_visible(true)
, m_contentsTexturesPurged(false)
, m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationLimit(),
- PriorityCalculator::allowEverythingCutoff(),
+ ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
0,
- PriorityCalculator::allowNothingCutoff())
+ ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING)
, m_backgroundColor(0)
, m_hasTransparentBackground(false)
, m_needsUpdateDrawProperties(false)
@@ -764,22 +764,24 @@ void LayerTreeHostImpl::enforceManagedMemoryPolicy(const ManagedMemoryPolicy& po
{
bool evictedResources = m_client->reduceContentsTextureMemoryOnImplThread(
m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible,
- m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible);
+ ManagedMemoryPolicy::priorityCutoffToValue(
+ m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible));
if (evictedResources) {
setContentsTexturesPurged();
m_client->setNeedsCommitOnImplThread();
m_client->onCanDrawStateChanged(canDraw());
}
- m_client->sendManagedMemoryStats();
if (m_tileManager) {
- // TODO(nduca): Pass something useful into the memory manager.
LOG(INFO) << "Setting up initial tile manager policy";
GlobalStateThatImpactsTilePriority new_state(m_tileManager->GlobalState());
- new_state.memory_limit_in_bytes = PrioritizedResourceManager::defaultMemoryAllocationLimit();
- new_state.memory_limit_policy = ALLOW_ANYTHING;
+ new_state.memory_limit_in_bytes = m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible;
+ new_state.memory_limit_policy = ManagedMemoryPolicy::priorityCutoffToTileMemoryLimitPolicy(
+ m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible);
m_tileManager->SetGlobalState(new_state);
}
+
+ m_client->sendManagedMemoryStats();
}
bool LayerTreeHostImpl::hasImplThread() const
@@ -803,6 +805,14 @@ void LayerTreeHostImpl::ScheduleCheckForCompletedSetPixels()
m_client->setNeedsRedrawOnImplThread();
}
+void LayerTreeHostImpl::SendTileManagerMemoryStats(
+ size_t memoryRequiredBytes,
+ size_t memoryNiceToHaveBytes,
+ size_t memoryUsedBytes)
+{
+ sendManagedMemoryStats(memoryRequiredBytes, memoryNiceToHaveBytes, memoryUsedBytes);
+}
+
bool LayerTreeHostImpl::shouldClearRootRenderPass() const
{
return m_settings.shouldClearRootRenderPass;
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/managed_memory_policy.h » ('j') | cc/thread_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698