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

Unified Diff: cc/layer_tree_host.cc

Issue 11413123: cc: switch to new WebLayerTreeViewClient API for requesting font atlas (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing tests 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') | cc/layer_tree_host_client.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 30bae774b5d612f7430fb860d6cecb3621fc698f..ed393fbfa3ea35bcf2cd4e8cdcb539cf31cc9033 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -64,6 +64,11 @@ bool LayerTreeDebugState::showHudRects() const
return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
}
+bool LayerTreeDebugState::hudNeedsFont() const
+{
+ return showFPSCounter || showPlatformLayerTree;
+}
+
bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b)
{
return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0;
@@ -339,27 +344,23 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
m_commitNumber++;
}
-void LayerTreeHost::createHUDLayerIfNeeded()
-{
- if (!m_hudLayer)
- m_hudLayer = HeadsUpDisplayLayer::create();
-}
-
-void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
-{
- createHUDLayerIfNeeded();
- m_hudLayer->setFontAtlas(fontAtlas.Pass());
-}
-
void LayerTreeHost::willCommit()
egraether 2012/11/30 21:27:56 With LayerTreeDebugState and font atlas creation o
{
m_client->willCommit();
- if (m_debugState.showHudInfo())
- createHUDLayerIfNeeded();
+ if (m_debugState.showHudInfo()) {
+ if (!m_hudLayer)
+ m_hudLayer = HeadsUpDisplayLayer::create();
- if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
- m_rootLayer->addChild(m_hudLayer);
+ if (m_debugState.hudNeedsFont() && !m_hudLayer->hasFontAtlas())
+ m_hudLayer->setFontAtlas(m_client->createFontAtlas());
+
+ if (m_rootLayer && !m_hudLayer->parent())
+ m_rootLayer->addChild(m_hudLayer);
+ } else if (m_hudLayer) {
+ m_hudLayer->removeFromParent();
+ m_hudLayer = 0;
egraether 2012/11/30 21:27:56 The hudLayer gets released when no longer needed,
+ }
}
void LayerTreeHost::commitComplete()
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698