Chromium Code Reviews| Index: cc/layer_tree_host.cc |
| diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
| index 003f13031f6ff46d1fadbba44f5e22ebcf329160..f6c55d6df21664a40b970a45ce57eae474cc9a53 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" |
| @@ -38,15 +37,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,15 +51,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); |
| + |
| + globalHudLayerSettings.showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects); |
| + globalHudLayerSettings.showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects); |
| + globalHudLayerSettings.showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects); |
| + globalHudLayerSettings.showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
| + globalHudLayerSettings.showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects); |
| + globalHudLayerSettings.showNonOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects); |
| } |
| LayerTreeSettings::~LayerTreeSettings() |
| @@ -292,33 +283,21 @@ 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(); |
| + HeadsUpDisplayLayerSettings settings = m_settings.globalHudLayerSettings.merge(m_localHUDLayerSettings); |
|
egraether
2012/11/20 21:30:30
or'ing global and local settings
|
| + |
| + if (settings.showDebugInfo()) |
| + requestHudLayer(); |
| - if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) |
| - m_rootLayer->addChild(m_hudLayer); |
| + if (m_hudLayer) { |
| + m_hudLayer->setSettings(settings); |
| + |
| + if (m_rootLayer && !m_hudLayer->parent()) |
| + m_rootLayer->addChild(m_hudLayer); |
| + } |
| } |
| void LayerTreeHost::commitComplete() |
| @@ -812,6 +791,20 @@ void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) |
| setNeedsCommit(); |
| } |
| +HeadsUpDisplayLayer* LayerTreeHost::requestHudLayer() |
| +{ |
| + if (!m_hudLayer.get()) |
| + m_hudLayer = HeadsUpDisplayLayer::create(); |
| + |
| + return m_hudLayer.get(); |
| +} |
| + |
| +void LayerTreeHost::setHudLayerSettings(const HeadsUpDisplayLayerSettings& settings) |
| +{ |
| + m_localHUDLayerSettings = settings; |
| + setNeedsCommit(); |
| +} |
| + |
| void LayerTreeHost::animateLayers(base::TimeTicks time) |
| { |
| if (!m_settings.acceleratedAnimationEnabled || !m_needsAnimateLayers) |