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

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: added DCHECKs and moved hasFontAtlas into HUDLayer 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..fe7c1718a9b1c92905c746d3f9e621aac30dcef0 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,44 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
m_commitNumber++;
}
+void CCLayerTreeHost::setShowFPSCounter(bool show)
+{
+ createHUDLayerIfNeeded();
+ DCHECK(hasFontAtlas());
+ m_hudLayer->setShowFPSCounter(show);
+ setNeedsCommit();
enne (OOO) 2012/10/24 18:35:27 You have multiple layers of setNeedsCommit here.
+}
+
+bool CCLayerTreeHost::hasFontAtlas() const
+{
+ return m_hudLayer && m_hudLayer->hasFontAtlas();
+}
+
void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas)
{
- m_fontAtlas = fontAtlas.Pass();
+ createHUDLayerIfNeeded();
enne (OOO) 2012/10/24 18:35:27 Why does this create the hud layer? What if none o
+ 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())
+ createHUDLayerIfNeeded();
- if (!m_hudLayer->parent())
- m_rootLayer->addChild(m_hudLayer);
- }
+ if (m_settings.showPlatformLayerTree)
+ DCHECK(hasFontAtlas());
enne (OOO) 2012/10/24 18:35:27 Maybe just move all the checks for the font atlas
+
+ 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