Chromium Code Reviews| 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..4f636a21479e796e838424664398df1f327d1ea7 100644 |
| --- a/cc/layer_tree_host_impl.cc |
| +++ b/cc/layer_tree_host_impl.cc |
| @@ -32,6 +32,7 @@ |
| #include "cc/software_renderer.h" |
| #include "cc/solid_color_draw_quad.h" |
| #include "cc/texture_uploader.h" |
| +#include "cc/util.h" |
| #include "ui/gfx/size_conversions.h" |
| #include "ui/gfx/vector2d_conversions.h" |
| @@ -227,6 +228,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 +1623,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 |
| + // at which we spam the GPU process. |
| + const size_t roundingStep = 8 * 1024 * 1024; |
|
jamesr
2012/12/07 23:19:12
nit: "static const ...", so you don't get another
ccameron
2012/12/08 00:21:15
Done.
|
| + memoryVisibleBytes = RoundUp(memoryVisibleBytes, roundingStep); |
| + memoryVisibleAndNearbyBytes = RoundUp(memoryVisibleAndNearbyBytes, roundingStep); |
| + memoryUseBytes = RoundUp(memoryUseBytes, roundingStep); |
| + if (m_lastSentMemoryVisibleBytes == memoryVisibleBytes && |
| + 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); |