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

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: Rebase to 166046 Created 8 years, 1 month 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.h ('k') | webkit/compositor_bindings/web_layer_tree_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 92e443584b95aebd62e68d2518b154815936ca1c..07d25919130c69184427d5f9e1bdf6d492fe05f6 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -39,7 +39,6 @@ bool LayerTreeHost::s_needsFilterContext = false;
LayerTreeSettings::LayerTreeSettings()
: acceleratePainting(false)
- , showFPSCounter(false)
, showPlatformLayerTree(false)
, showPaintRects(false)
, showPropertyChangedRects(false)
@@ -280,25 +279,33 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
m_commitNumber++;
}
+void LayerTreeHost::createHUDLayerIfNeeded()
+{
+ if (!m_hudLayer)
+ m_hudLayer = HeadsUpDisplayLayer::create();
+}
+
+void LayerTreeHost::setShowFPSCounter(bool show)
+{
+ createHUDLayerIfNeeded();
+ m_hudLayer->setShowFPSCounter(show);
+}
+
void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
{
- m_fontAtlas = fontAtlas.Pass();
- setNeedsCommit();
+ createHUDLayerIfNeeded();
+ m_hudLayer->setFontAtlas(fontAtlas.Pass());
}
void LayerTreeHost::willCommit()
{
m_client->willCommit();
- if (m_rootLayer && m_settings.showDebugInfo()) {
- if (!m_hudLayer)
- m_hudLayer = HeadsUpDisplayLayer::create();
- if (m_fontAtlas.get())
- m_hudLayer->setFontAtlas(m_fontAtlas.Pass());
+ if (m_settings.showDebugInfo())
+ createHUDLayerIfNeeded();
- if (!m_hudLayer->parent())
- m_rootLayer->addChild(m_hudLayer);
- }
+ if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
+ m_rootLayer->addChild(m_hudLayer);
}
void LayerTreeHost::commitComplete()
« no previous file with comments | « cc/layer_tree_host.h ('k') | webkit/compositor_bindings/web_layer_tree_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698