Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / cc / base / switches.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/base/switches.h"
6
7 #include "base/command_line.h"
8
9 namespace cc {
10 namespace switches {
11
12 // On platforms where checkerboards are used, prefer background colors instead
13 // of checkerboards.
14 const char kBackgroundColorInsteadOfCheckerboard[] =
15     "background-color-instead-of-checkerboard";
16
17 // Disables LCD text.
18 const char kDisableLCDText[] = "disable-lcd-text";
19
20 const char kDisableThreadedAnimation[] = "disable-threaded-animation";
21
22 // Disables layer-edge anti-aliasing in the compositor.
23 const char kDisableCompositedAntialiasing[] =
24     "disable-composited-antialiasing";
25
26 // Paint content on the main thread instead of the compositor thread.
27 // Overrides the kEnableImplSidePainting flag.
28 const char kDisableImplSidePainting[] = "disable-impl-side-painting";
29
30 // Enables LCD text.
31 const char kEnableLCDText[] = "enable-lcd-text";
32
33 // Paint content on the compositor thread instead of the main thread.
34 const char kEnableImplSidePainting[] = "enable-impl-side-painting";
35
36 const char kEnableTopControlsPositionCalculation[] =
37     "enable-top-controls-position-calculation";
38
39 // Allow heuristics to determine when a layer tile should be drawn with
40 // the Skia GPU backend.  Only valid with GPU accelerated compositing +
41 // impl-side painting.
42 const char kEnableGPURasterization[] = "enable-gpu-rasterization";
43
44 // Disable GPU rasterization, i.e. rasterize on the CPU only.
45 // Overrides the kEnableGPURasterization flag.
46 const char kDisableGPURasterization[] = "disable-gpu-rasterization";
47
48 // The height of the movable top controls.
49 const char kTopControlsHeight[] = "top-controls-height";
50
51 // Percentage of the top controls need to be hidden before they will auto hide.
52 const char kTopControlsHideThreshold[] = "top-controls-hide-threshold";
53
54 // Percentage of the top controls need to be shown before they will auto show.
55 const char kTopControlsShowThreshold[] = "top-controls-show-threshold";
56
57 // Show metrics about overdraw in about:tracing recordings, such as the number
58 // of pixels culled, and the number of pixels drawn, for each frame.
59 const char kTraceOverdraw[] = "trace-overdraw";
60
61 // Re-rasters everything multiple times to simulate a much slower machine.
62 // Give a scale factor to cause raster to take that many times longer to
63 // complete, such as --slow-down-raster-scale-factor=25.
64 const char kSlowDownRasterScaleFactor[] = "slow-down-raster-scale-factor";
65
66 // Max tiles allowed for each tilings interest area.
67 const char kMaxTilesForInterestArea[] = "max-tiles-for-interest-area";
68
69 // The amount of unused resource memory compositor is allowed to keep around.
70 const char kMaxUnusedResourceMemoryUsagePercentage[] =
71     "max-unused-resource-memory-usage-percentage";
72
73 // Causes the compositor to render to textures which are then sent to the parent
74 // through the texture mailbox mechanism.
75 // Requires --enable-compositor-frame-message.
76 const char kCompositeToMailbox[] = "composite-to-mailbox";
77
78 // Check that property changes during paint do not occur.
79 const char kStrictLayerPropertyChangeChecking[] =
80     "strict-layer-property-change-checking";
81
82 // Virtual viewport for fixed-position elements, scrollbars during pinch.
83 const char kEnablePinchVirtualViewport[] = "enable-pinch-virtual-viewport";
84
85 // Disable partial swap which is needed for some OpenGL drivers / emulators.
86 const char kUIDisablePartialSwap[] = "ui-disable-partial-swap";
87
88 const char kEnablePerTilePainting[] = "enable-per-tile-painting";
89 const char kUIEnablePerTilePainting[] = "ui-enable-per-tile-painting";
90
91 // Enables the GPU benchmarking extension
92 const char kEnableGpuBenchmarking[] = "enable-gpu-benchmarking";
93
94 // Renders a border around compositor layers to help debug and study
95 // layer compositing.
96 const char kShowCompositedLayerBorders[] = "show-composited-layer-borders";
97 const char kUIShowCompositedLayerBorders[] = "ui-show-layer-borders";
98
99 // Draws a FPS indicator
100 const char kShowFPSCounter[] = "show-fps-counter";
101 const char kUIShowFPSCounter[] = "ui-show-fps-counter";
102
103 // Renders a border that represents the bounding box for the layer's animation.
104 const char kShowLayerAnimationBounds[] = "show-layer-animation-bounds";
105 const char kUIShowLayerAnimationBounds[] = "ui-show-layer-animation-bounds";
106
107 // Show rects in the HUD around layers whose properties have changed.
108 const char kShowPropertyChangedRects[] = "show-property-changed-rects";
109 const char kUIShowPropertyChangedRects[] = "ui-show-property-changed-rects";
110
111 // Show rects in the HUD around damage as it is recorded into each render
112 // surface.
113 const char kShowSurfaceDamageRects[] = "show-surface-damage-rects";
114 const char kUIShowSurfaceDamageRects[] = "ui-show-surface-damage-rects";
115
116 // Show rects in the HUD around the screen-space transformed bounds of every
117 // layer.
118 const char kShowScreenSpaceRects[] = "show-screenspace-rects";
119 const char kUIShowScreenSpaceRects[] = "ui-show-screenspace-rects";
120
121 // Show rects in the HUD around the screen-space transformed bounds of every
122 // layer's replica, when they have one.
123 const char kShowReplicaScreenSpaceRects[] = "show-replica-screenspace-rects";
124 const char kUIShowReplicaScreenSpaceRects[] =
125     "ui-show-replica-screenspace-rects";
126
127 // Show rects in the HUD wherever something is known to be drawn opaque and is
128 // considered occluding the pixels behind it.
129 const char kShowOccludingRects[] = "show-occluding-rects";
130 const char kUIShowOccludingRects[] = "ui-show-occluding-rects";
131
132 // Show rects in the HUD wherever something is not known to be drawn opaque and
133 // is not considered to be occluding the pixels behind it.
134 const char kShowNonOccludingRects[] = "show-nonoccluding-rects";
135 const char kUIShowNonOccludingRects[] = "ui-show-nonoccluding-rects";
136
137 // Enable rasterizer that writes directly to GPU memory.
138 const char kEnableMapImage[] = "enable-map-image";
139
140 // Disable rasterizer that writes directly to GPU memory.
141 // Overrides the kEnableMapImage flag.
142 const char kDisableMapImage[] = "disable-map-image";
143
144 // Prevents the layer tree unit tests from timing out.
145 const char kCCLayerTreeTestNoTimeout[] = "cc-layer-tree-test-no-timeout";
146
147 // Makes pixel tests write their output instead of read it.
148 const char kCCRebaselinePixeltests[] = "cc-rebaseline-pixeltests";
149
150 // Disable textures using RGBA_4444 layout.
151 const char kDisable4444Textures[] = "disable-4444-textures";
152
153 // Disable touch hit testing in the compositor.
154 const char kDisableCompositorTouchHitTesting[] =
155     "disable-compositor-touch-hit-testing";
156
157 bool IsLCDTextEnabled() {
158   const CommandLine* command_line = CommandLine::ForCurrentProcess();
159   if (command_line->HasSwitch(switches::kDisableLCDText))
160     return false;
161   else if (command_line->HasSwitch(switches::kEnableLCDText))
162     return true;
163
164 #if defined(OS_ANDROID)
165   return false;
166 #else
167   return true;
168 #endif
169 }
170
171 bool IsGpuRasterizationEnabled() {
172   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
173
174   if (command_line.HasSwitch(switches::kDisableGPURasterization))
175     return false;
176   else if (command_line.HasSwitch(switches::kEnableGPURasterization))
177     return true;
178
179   return false;
180 }
181
182 bool IsImplSidePaintingEnabled() {
183   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
184
185   if (command_line.HasSwitch(switches::kDisableImplSidePainting))
186     return false;
187   else if (command_line.HasSwitch(switches::kEnableImplSidePainting))
188     return true;
189
190 #if defined(OS_ANDROID)
191   return true;
192 #else
193   return false;
194 #endif
195 }
196
197 bool IsMapImageEnabled() {
198   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
199
200   if (command_line.HasSwitch(switches::kDisableMapImage))
201     return false;
202   else if (command_line.HasSwitch(switches::kEnableMapImage))
203     return true;
204
205   return false;
206 }
207
208 }  // namespace switches
209 }  // namespace cc