Index: cc/layer_tree_host_impl.cc |
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
index 8f32526fbc635f0ef6ac3375c45755e1b89b4618..04877436d826629cedee1a7abb91464b7337c466 100644 |
--- a/cc/layer_tree_host_impl.cc |
+++ b/cc/layer_tree_host_impl.cc |
@@ -227,6 +227,9 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre |
, m_numImplThreadScrolls(0) |
, m_numMainThreadScrolls(0) |
, m_cumulativeNumLayersDrawn(0) |
+ , m_lastSentMemoryVisibleBytes(0) |
+ , m_lastSentMemoryVisibleAndNearbyBytes(0) |
+ , m_lastSentMemoryUseBytes(0) |
{ |
DCHECK(m_proxy->isImplThread()); |
didVisibilityChange(this, m_visible); |
@@ -1619,6 +1622,34 @@ void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const |
m_tileManager->renderingStats(stats); |
} |
+void LayerTreeHostImpl::sendManagedMemoryStats( |
+ size_t memoryVisibleBytes, |
+ size_t memoryVisibleAndNearbyBytes, |
+ size_t memoryUseBytes) |
+{ |
+ if (!renderer()) |
+ return; |
+ |
+ // Round the numbers being sent up to the next 8MB, to throttle the rate |
ccameron
2012/12/07 21:58:41
Do we have a ROUND_UP macro, or something like tha
|
+ // at which we spam the GPU process. |
+ const size_t roundingStep = 8 * 1024 * 1024; |
+ memoryVisibleBytes = ((memoryVisibleBytes + roundingStep - 1) / roundingStep) * roundingStep; |
+ memoryVisibleAndNearbyBytes = ((memoryVisibleAndNearbyBytes + roundingStep - 1) / roundingStep) * roundingStep; |
+ memoryUseBytes = ((memoryUseBytes + roundingStep - 1) / roundingStep) * roundingStep; |
+ if (m_lastSentMemoryVisibleBytes == memoryVisibleBytes && |
jamesr
2012/12/07 22:14:34
alternately, why not just calculate a diff from th
ccameron
2012/12/07 22:33:49
The is less artifact-prone (it doesn't depend on t
|
+ m_lastSentMemoryVisibleAndNearbyBytes == memoryVisibleAndNearbyBytes && |
+ m_lastSentMemoryUseBytes == memoryUseBytes) { |
+ return; |
+ } |
+ m_lastSentMemoryVisibleBytes = memoryVisibleBytes; |
+ m_lastSentMemoryVisibleAndNearbyBytes = memoryVisibleAndNearbyBytes; |
+ m_lastSentMemoryUseBytes = memoryUseBytes; |
+ |
+ renderer()->sendManagedMemoryStats(m_lastSentMemoryVisibleBytes, |
+ m_lastSentMemoryVisibleAndNearbyBytes, |
+ m_lastSentMemoryUseBytes); |
+} |
+ |
void LayerTreeHostImpl::animateScrollbars(base::TimeTicks time) |
{ |
animateScrollbarsRecursive(m_rootLayerImpl.get(), time); |