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

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: rewrote to LayerTreeSwitches 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 003f13031f6ff46d1fadbba44f5e22ebcf329160..d305e28007685566f08dfdd7c511df957cb06837 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -7,7 +7,6 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/message_loop.h"
-#include "cc/font_atlas.h"
#include "cc/graphics_context.h"
#include "cc/heads_up_display_layer.h"
#include "cc/heads_up_display_layer_impl.h"
@@ -36,10 +35,10 @@ namespace cc {
bool LayerTreeHost::s_needsFilterContext = false;
-LayerTreeSettings::LayerTreeSettings()
- : acceleratePainting(false)
- , showDebugBorders(false)
+LayerTreeSwitches::LayerTreeSwitches()
+ : showFPSCounter(false)
, showPlatformLayerTree(false)
+ , showDebugBorders(false)
, showPaintRects(false)
, showPropertyChangedRects(false)
, showSurfaceDamageRects(false)
@@ -47,6 +46,44 @@ LayerTreeSettings::LayerTreeSettings()
, showReplicaScreenSpaceRects(false)
, showOccludingRects(false)
, showNonOccludingRects(false)
+{
+}
+
+LayerTreeSwitches::~LayerTreeSwitches()
+{
+}
+
+bool LayerTreeSwitches::showHudInfo() const
+{
+ return showFPSCounter || showPlatformLayerTree || showHudRects();
+}
+
+bool LayerTreeSwitches::showHudRects() const
+{
+ return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
+}
+
+LayerTreeSwitches LayerTreeSwitches::merge(const LayerTreeSwitches& other) const
+{
+ LayerTreeSwitches switches;
+
+ switches.showFPSCounter = showFPSCounter | other.showFPSCounter;
+ switches.showPlatformLayerTree = showPlatformLayerTree | other.showPlatformLayerTree;
+ switches.showDebugBorders = showDebugBorders | other.showDebugBorders;
+
+ switches.showPaintRects = showPaintRects | other.showPaintRects;
+ switches.showPropertyChangedRects = showPropertyChangedRects | other.showPropertyChangedRects;
+ switches.showSurfaceDamageRects = showSurfaceDamageRects | other.showSurfaceDamageRects;
+ switches.showScreenSpaceRects = showScreenSpaceRects | other.showScreenSpaceRects;
+ switches.showReplicaScreenSpaceRects = showReplicaScreenSpaceRects | other.showReplicaScreenSpaceRects;
+ switches.showOccludingRects = showOccludingRects | other.showOccludingRects;
+ switches.showNonOccludingRects = showNonOccludingRects | other.showNonOccludingRects;
+
+ return switches;
+}
+
+LayerTreeSettings::LayerTreeSettings()
+ : acceleratePainting(false)
, renderVSyncEnabled(true)
, perTilePaintingEnabled(false)
, partialSwapEnabled(false)
@@ -61,15 +98,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);
+
+ initialSwitchSettings.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects);
+ initialSwitchSettings.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects);
+ initialSwitchSettings.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects);
+ initialSwitchSettings.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
+ initialSwitchSettings.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects);
+ initialSwitchSettings.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects);
}
LayerTreeSettings::~LayerTreeSettings()
@@ -118,6 +156,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
, m_numTimesRecreateShouldFail(0)
, m_numFailedRecreateAttempts(0)
, m_settings(settings)
+ , m_switches(settings.initialSwitchSettings)
, m_deviceScaleFactor(1)
, m_visible(true)
, m_pageScaleFactor(1)
@@ -288,6 +327,7 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
hostImpl->setBackgroundColor(m_backgroundColor);
hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
+ hostImpl->setSwitches(m_switches);
egraether 2012/11/22 00:23:15 The switches get pushed to hostImpl. No more need
m_commitNumber++;
}
@@ -298,12 +338,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();
@@ -314,7 +348,7 @@ void LayerTreeHost::willCommit()
{
m_client->willCommit();
- if (m_settings.showDebugInfo())
+ if (m_switches.showHudInfo())
createHUDLayerIfNeeded();
if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
@@ -441,6 +475,12 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
setNeedsCommit();
}
+void LayerTreeHost::setSwitches(const LayerTreeSwitches& switches)
+{
+ m_switches = m_settings.initialSwitchSettings.merge(switches);
egraether 2012/11/22 00:23:15 The switches get or'ed together with the initial o
+ setNeedsCommit();
danakj 2012/11/26 19:57:18 We should avoid setting needsCommit if the new swi
+}
+
void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
{
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)

Powered by Google App Engine
This is Rietveld 408576698