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() |