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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 11470024: Don't spam the GPU process with memory usage stats (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
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/single_thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698