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

Unified Diff: cc/layer_tree_host.cc

Issue 11414017: cc: handling debug settings in new LayerTreeDebugState structure (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
Index: cc/layer_tree_host.cc
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 5aca174c0c4ca44362376f41058bf3a64ea00ff9..9c2c6210b9871529b500fd24053e33eaf752fee0 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -38,15 +38,6 @@ bool LayerTreeHost::s_needsFilterContext = false;
LayerTreeSettings::LayerTreeSettings()
: acceleratePainting(false)
- , showDebugBorders(false)
- , showPlatformLayerTree(false)
- , showPaintRects(false)
- , showPropertyChangedRects(false)
- , showSurfaceDamageRects(false)
- , showScreenSpaceRects(false)
- , showReplicaScreenSpaceRects(false)
- , showOccludingRects(false)
- , showNonOccludingRects(false)
, renderVSyncEnabled(true)
, perTilePaintingEnabled(false)
, partialSwapEnabled(false)
@@ -61,12 +52,6 @@ LayerTreeSettings::LayerTreeSettings()
, minimumOcclusionTrackingSize(gfx::Size(160, 160))
{
// TODO(danakj): Move this to chromium when we don't go through the WebKit API anymore.
- showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
- showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
- showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
- showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
- showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
- showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePartialSwap);
backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(switches::kBackgroundColorInsteadOfCheckerboard);
showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches::kTraceOverdraw);
@@ -129,6 +114,19 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
, m_partialTextureUpdateRequests(0)
{
numLayerTreeInstances++;
+
+ HeadsUpDisplayLayerFlags flags;
+
+ // TODO(danakj): Move this to chromium when we don't go through the WebKit API anymore.
+ flags.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
egraether 2012/11/15 23:37:07 I moved the commandline reading for the rectangle
+ flags.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
+ flags.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
+ flags.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
+ flags.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
+ flags.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
+
+ if (flags.showDebugInfo())
+ requestHUDLayer()->setFlags(flags);
}
bool LayerTreeHost::initialize(scoped_ptr<Thread> implThread)
@@ -292,31 +290,10 @@ 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)
-{
- createHUDLayerIfNeeded();
- m_hudLayer->setFontAtlas(fontAtlas.Pass());
-}
-
void LayerTreeHost::willCommit()
{
m_client->willCommit();
- if (m_settings.showDebugInfo())
- createHUDLayerIfNeeded();
-
if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
m_rootLayer->addChild(m_hudLayer);
}
@@ -812,6 +789,14 @@ void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor)
setNeedsCommit();
}
+HeadsUpDisplayLayer* LayerTreeHost::requestHUDLayer()
+{
+ if (!m_hudLayer.get())
+ m_hudLayer = HeadsUpDisplayLayer::create();
+
+ return m_hudLayer.get();
+}
+
void LayerTreeHost::animateLayers(base::TimeTicks time)
{
if (!m_settings.acceleratedAnimationEnabled || !m_needsAnimateLayers)

Powered by Google App Engine
This is Rietveld 408576698