| 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..425ec7ed38b10876eb613357dbe23ffeb0f91b4b 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
|
| @@ -1674,6 +1676,16 @@ void LayerTreeHostImpl::sendManagedMemoryStats(
|
| if (!renderer())
|
| return;
|
|
|
| + // If we are doing impl-side painting, then override the values we were
|
| + // handed by the prioritized resource manager with values from the tile
|
| + // manager.
|
| + if (m_tileManager) {
|
| + m_tileManager->GetManagedMemoryStats(
|
| + &memoryVisibleBytes,
|
| + &memoryVisibleAndNearbyBytes,
|
| + &memoryUseBytes);
|
| + }
|
| +
|
| // Round the numbers being sent up to the next 8MB, to throttle the rate
|
| // at which we spam the GPU process.
|
| static const size_t roundingStep = 8 * 1024 * 1024;
|
|
|