| Index: cc/layer_tree_host_impl.cc
|
| diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
|
| index d9a2a08c3c267f6992a82613839b8c2e06ac9a87..3df81c250e986d9256e68da20460daa481e34361 100644
|
| --- a/cc/layer_tree_host_impl.cc
|
| +++ b/cc/layer_tree_host_impl.cc
|
| @@ -33,6 +33,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"
|
|
|
| @@ -223,6 +224,9 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
|
| , m_numMainThreadScrolls(0)
|
| , m_cumulativeNumLayersDrawn(0)
|
| , m_cumulativeNumMissingTiles(0)
|
| + , m_lastSentMemoryVisibleBytes(0)
|
| + , m_lastSentMemoryVisibleAndNearbyBytes(0)
|
| + , m_lastSentMemoryUseBytes(0)
|
| {
|
| DCHECK(m_proxy->isImplThread());
|
| didVisibilityChange(this, m_visible);
|
| @@ -1584,6 +1588,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.
|
| + static const size_t roundingStep = 8 * 1024 * 1024;
|
| + 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(rootLayer(), time);
|
|
|