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

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: Rebase to 170216 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_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 25d3d2730df1cb0cbbc4cb3441053dc75405acdf..30bae774b5d612f7430fb860d6cecb3621fc698f 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -36,11 +36,10 @@ namespace cc {
bool LayerTreeHost::s_needsFilterContext = false;
-LayerTreeSettings::LayerTreeSettings()
- : acceleratePainting(false)
- , implSidePainting(false)
- , showDebugBorders(false)
+LayerTreeDebugState::LayerTreeDebugState()
+ : showFPSCounter(false)
, showPlatformLayerTree(false)
+ , showDebugBorders(false)
, showPaintRects(false)
, showPropertyChangedRects(false)
, showSurfaceDamageRects(false)
@@ -48,6 +47,50 @@ LayerTreeSettings::LayerTreeSettings()
, showReplicaScreenSpaceRects(false)
, showOccludingRects(false)
, showNonOccludingRects(false)
+{
+}
+
+LayerTreeDebugState::~LayerTreeDebugState()
+{
+}
+
+bool LayerTreeDebugState::showHudInfo() const
+{
+ return showFPSCounter || showPlatformLayerTree || showHudRects();
+}
+
+bool LayerTreeDebugState::showHudRects() const
+{
+ return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
+}
+
+bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDebugState& b)
+{
+ return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0;
+}
+
+LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, const LayerTreeDebugState& b)
+{
+ LayerTreeDebugState r(a);
+
+ r.showFPSCounter |= b.showFPSCounter;
+ r.showPlatformLayerTree |= b.showPlatformLayerTree;
+ r.showDebugBorders |= b.showDebugBorders;
+
+ r.showPaintRects |= b.showPaintRects;
+ r.showPropertyChangedRects |= b.showPropertyChangedRects;
+ r.showSurfaceDamageRects |= b.showSurfaceDamageRects;
+ r.showScreenSpaceRects |= b.showScreenSpaceRects;
+ r.showReplicaScreenSpaceRects |= b.showReplicaScreenSpaceRects;
+ r.showOccludingRects |= b.showOccludingRects;
+ r.showNonOccludingRects |= b.showNonOccludingRects;
+
+ return r;
+}
+
+LayerTreeSettings::LayerTreeSettings()
+ : acceleratePainting(false)
+ , implSidePainting(false)
, renderVSyncEnabled(true)
, perTilePaintingEnabled(false)
, partialSwapEnabled(false)
@@ -62,15 +105,16 @@ 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);
+
+ initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
+ initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
+ initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
+ initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
+ initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
+ initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
}
LayerTreeSettings::~LayerTreeSettings()
@@ -119,6 +163,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
, m_numTimesRecreateShouldFail(0)
, m_numFailedRecreateAttempts(0)
, m_settings(settings)
+ , m_debugState(settings.initialDebugState)
, m_deviceScaleFactor(1)
, m_visible(true)
, m_pageScaleFactor(1)
@@ -289,6 +334,7 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
hostImpl->setBackgroundColor(m_backgroundColor);
hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
+ hostImpl->setDebugState(m_debugState);
m_commitNumber++;
}
@@ -299,12 +345,6 @@ void LayerTreeHost::createHUDLayerIfNeeded()
m_hudLayer = HeadsUpDisplayLayer::create();
}
-void LayerTreeHost::setShowFPSCounter(bool show)
-{
- createHUDLayerIfNeeded();
- m_hudLayer->setShowFPSCounter(show);
-}
-
void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
{
createHUDLayerIfNeeded();
@@ -315,7 +355,7 @@ void LayerTreeHost::willCommit()
{
m_client->willCommit();
- if (m_settings.showDebugInfo())
+ if (m_debugState.showHudInfo())
createHUDLayerIfNeeded();
if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
@@ -442,6 +482,17 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
setNeedsCommit();
}
+void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState)
+{
+ LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.initialDebugState, debugState);
+
+ if (LayerTreeDebugState::equal(m_debugState, newDebugState))
+ return;
+
+ m_debugState = newDebugState;
+ setNeedsCommit();
+}
+
void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
{
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698