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

Unified Diff: cc/layer_tree_host.cc

Issue 11189037: toggle FPS counter in compositor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: plumbing 'showFPSCounter' through HUD, added 'createHUDLayerIfNeeded' Created 8 years, 2 months 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
Index: cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index c6d3003279fe669bbd01f13c33a3db5e99ef2f29..bcc42bb71a4969b8ea1729804ae0dfb28f36c806 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -38,7 +38,6 @@ bool CCLayerTreeHost::s_needsFilterContext = false;
CCLayerTreeSettings::CCLayerTreeSettings()
: acceleratePainting(false)
- , showFPSCounter(false)
, showPlatformLayerTree(false)
, showPaintRects(false)
, showPropertyChangedRects(false)
@@ -277,25 +276,35 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
m_commitNumber++;
}
+void CCLayerTreeHost::setShowFPSCounter(bool show)
+{
+ createHUDLayerIfNeeded();
danakj 2012/10/23 15:19:53 Can we DCHECK some stuff here? DCHECK(m_hudLayer);
+ m_hudLayer->setShowFPSCounter(show);
+ setNeedsCommit();
+}
+
void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas)
{
- m_fontAtlas = fontAtlas.Pass();
+ createHUDLayerIfNeeded();
+ m_hudLayer->setFontAtlas(fontAtlas.Pass());
setNeedsCommit();
}
+void CCLayerTreeHost::createHUDLayerIfNeeded()
+{
+ if (!m_hudLayer)
+ m_hudLayer = HeadsUpDisplayLayerChromium::create();
+}
+
void CCLayerTreeHost::willCommit()
{
m_client->willCommit();
- if (m_rootLayer && m_settings.showDebugInfo()) {
- if (!m_hudLayer)
- m_hudLayer = HeadsUpDisplayLayerChromium::create();
- if (m_fontAtlas.get())
- m_hudLayer->setFontAtlas(m_fontAtlas.Pass());
+ if (m_settings.showDebugRects())
danakj 2012/10/23 15:19:53 This is missing m_settings.showPlatformLayerTree.
+ createHUDLayerIfNeeded();
- if (!m_hudLayer->parent())
- m_rootLayer->addChild(m_hudLayer);
- }
+ if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
+ m_rootLayer->addChild(m_hudLayer);
}
void CCLayerTreeHost::commitComplete()

Powered by Google App Engine
This is Rietveld 408576698