OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 using namespace std; | 30 using namespace std; |
31 | 31 |
32 namespace { | 32 namespace { |
33 static int numLayerTreeInstances; | 33 static int numLayerTreeInstances; |
34 } | 34 } |
35 | 35 |
36 namespace cc { | 36 namespace cc { |
37 | 37 |
38 bool LayerTreeHost::s_needsFilterContext = false; | 38 bool LayerTreeHost::s_needsFilterContext = false; |
39 | 39 |
40 LayerTreeDebugState::LayerTreeDebugState() | |
41 : showFPSCounter(false) | |
42 , showPlatformLayerTree(false) | |
43 , showDebugBorders(false) | |
44 , showPaintRects(false) | |
45 , showPropertyChangedRects(false) | |
46 , showSurfaceDamageRects(false) | |
47 , showScreenSpaceRects(false) | |
48 , showReplicaScreenSpaceRects(false) | |
49 , showOccludingRects(false) | |
50 , showNonOccludingRects(false) | |
51 { | |
52 } | |
53 | |
54 LayerTreeDebugState::~LayerTreeDebugState() | |
55 { | |
56 } | |
57 | |
58 bool LayerTreeDebugState::showHudInfo() const | |
59 { | |
60 return showFPSCounter || showPlatformLayerTree || showHudRects(); | |
61 } | |
62 | |
63 bool LayerTreeDebugState::showHudRects() const | |
64 { | |
65 return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects
|| showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects ||
showNonOccludingRects; | |
66 } | |
67 | |
68 bool LayerTreeDebugState::hudNeedsFont() const | |
69 { | |
70 return showFPSCounter || showPlatformLayerTree; | |
71 } | |
72 | |
73 bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDeb
ugState& b) | |
74 { | |
75 return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0; | |
76 } | |
77 | |
78 LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, con
st LayerTreeDebugState& b) | |
79 { | |
80 LayerTreeDebugState r(a); | |
81 | |
82 r.showFPSCounter |= b.showFPSCounter; | |
83 r.showPlatformLayerTree |= b.showPlatformLayerTree; | |
84 r.showDebugBorders |= b.showDebugBorders; | |
85 | |
86 r.showPaintRects |= b.showPaintRects; | |
87 r.showPropertyChangedRects |= b.showPropertyChangedRects; | |
88 r.showSurfaceDamageRects |= b.showSurfaceDamageRects; | |
89 r.showScreenSpaceRects |= b.showScreenSpaceRects; | |
90 r.showReplicaScreenSpaceRects |= b.showReplicaScreenSpaceRects; | |
91 r.showOccludingRects |= b.showOccludingRects; | |
92 r.showNonOccludingRects |= b.showNonOccludingRects; | |
93 | |
94 return r; | |
95 } | |
96 | |
97 LayerTreeSettings::LayerTreeSettings() | |
98 : acceleratePainting(false) | |
99 , implSidePainting(false) | |
100 , renderVSyncEnabled(true) | |
101 , perTilePaintingEnabled(false) | |
102 , partialSwapEnabled(false) | |
103 , acceleratedAnimationEnabled(true) | |
104 , pageScalePinchZoomEnabled(false) | |
105 , backgroundColorInsteadOfCheckerboard(false) | |
106 , showOverdrawInTracing(false) | |
107 , refreshRate(0) | |
108 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | |
109 , numRasterThreads(1) | |
110 , defaultTileSize(gfx::Size(256, 256)) | |
111 , maxUntiledLayerSize(gfx::Size(512, 512)) | |
112 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | |
113 { | |
114 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | |
115 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | |
116 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | |
117 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | |
118 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | |
119 | |
120 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | |
121 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | |
122 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | |
123 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | |
124 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | |
125 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | |
126 | |
127 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
128 switches::kNumRasterThreads)) { | |
129 const size_t kMaxRasterThreads = 64; | |
130 std::string num_raster_threads = | |
131 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
132 switches::kNumRasterThreads); | |
133 int num_threads; | |
134 if (base::StringToInt(num_raster_threads, &num_threads) && | |
135 num_threads > 0 && num_threads <= kMaxRasterThreads) { | |
136 numRasterThreads = num_threads; | |
137 } else { | |
138 LOG(WARNING) << "Bad number of raster threads: " << | |
139 num_raster_threads; | |
140 } | |
141 } | |
142 } | |
143 | |
144 LayerTreeSettings::~LayerTreeSettings() | |
145 { | |
146 } | |
147 | |
148 RendererCapabilities::RendererCapabilities() | 40 RendererCapabilities::RendererCapabilities() |
149 : bestTextureFormat(0) | 41 : bestTextureFormat(0) |
150 , usingPartialSwap(false) | 42 , usingPartialSwap(false) |
151 , usingAcceleratedPainting(false) | 43 , usingAcceleratedPainting(false) |
152 , usingSetVisibility(false) | 44 , usingSetVisibility(false) |
153 , usingSwapCompleteCallback(false) | 45 , usingSwapCompleteCallback(false) |
154 , usingGpuMemoryManager(false) | 46 , usingGpuMemoryManager(false) |
155 , usingDiscardBackbuffer(false) | 47 , usingDiscardBackbuffer(false) |
156 , usingEglImage(false) | 48 , usingEglImage(false) |
157 , allowPartialTextureUpdates(false) | 49 , allowPartialTextureUpdates(false) |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 else | 867 else |
976 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 868 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
977 } | 869 } |
978 } | 870 } |
979 | 871 |
980 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 872 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
981 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 873 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
982 } | 874 } |
983 | 875 |
984 } // namespace cc | 876 } // namespace cc |
OLD | NEW |