cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / base / switches.cc
blob3fc43029c266cd1666695f7a90dc110953523bf7
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.
5 #include "cc/base/switches.h"
7 #include "base/command_line.h"
9 namespace cc {
10 namespace switches {
12 // On platforms where checkerboards are used, prefer background colors instead
13 // of checkerboards.
14 const char kBackgroundColorInsteadOfCheckerboard[] =
15 "background-color-instead-of-checkerboard";
17 const char kDisableThreadedAnimation[] = "disable-threaded-animation";
19 // Disables layer-edge anti-aliasing in the compositor.
20 const char kDisableCompositedAntialiasing[] =
21 "disable-composited-antialiasing";
23 // Paint content on the main thread instead of the compositor thread.
24 // Overrides the kEnableImplSidePainting flag.
25 const char kDisableImplSidePainting[] = "disable-impl-side-painting";
27 // Paint content on the compositor thread instead of the main thread.
28 const char kEnableImplSidePainting[] = "enable-impl-side-painting";
30 const char kEnableTopControlsPositionCalculation[] =
31 "enable-top-controls-position-calculation";
33 // For any layers that can get drawn directly to screen, draw them with the Skia
34 // GPU backend. Only valid with gl rendering + threaded compositing + impl-side
35 // painting.
36 const char kForceDirectLayerDrawing[] = "force-direct-layer-drawing";
38 // The height of the movable top controls.
39 const char kTopControlsHeight[] = "top-controls-height";
41 // Percentage of the top controls need to be hidden before they will auto hide.
42 const char kTopControlsHideThreshold[] = "top-controls-hide-threshold";
44 // Percentage of the top controls need to be shown before they will auto show.
45 const char kTopControlsShowThreshold[] = "top-controls-show-threshold";
47 // Number of worker threads used to rasterize content.
48 const char kNumRasterThreads[] = "num-raster-threads";
50 // Show metrics about overdraw in about:tracing recordings, such as the number
51 // of pixels culled, and the number of pixels drawn, for each frame.
52 const char kTraceOverdraw[] = "trace-overdraw";
54 // Re-rasters everything multiple times to simulate a much slower machine.
55 // Give a scale factor to cause raster to take that many times longer to
56 // complete, such as --slow-down-raster-scale-factor=25.
57 const char kSlowDownRasterScaleFactor[] = "slow-down-raster-scale-factor";
59 // The scale factor for low resolution tile contents.
60 const char kLowResolutionContentsScaleFactor[] =
61 "low-resolution-contents-scale-factor";
63 // Max tiles allowed for each tilings interest area.
64 const char kMaxTilesForInterestArea[] = "max-tiles-for-interest-area";
66 // The amount of unused resource memory compositor is allowed to keep around.
67 const char kMaxUnusedResourceMemoryUsagePercentage[] =
68 "max-unused-resource-memory-usage-percentage";
70 // Causes the compositor to render to textures which are then sent to the parent
71 // through the texture mailbox mechanism.
72 // Requires --enable-compositor-frame-message.
73 const char kCompositeToMailbox[] = "composite-to-mailbox";
75 // Check that property changes during paint do not occur.
76 const char kStrictLayerPropertyChangeChecking[] =
77 "strict-layer-property-change-checking";
79 // Virtual viewport for fixed-position elements, scrollbars during pinch.
80 const char kEnablePinchVirtualViewport[] = "enable-pinch-virtual-viewport";
82 const char kEnablePartialSwap[] = "enable-partial-swap";
83 // Disable partial swap which is needed for some OpenGL drivers / emulators.
84 const char kUIDisablePartialSwap[] = "ui-disable-partial-swap";
86 const char kEnablePerTilePainting[] = "enable-per-tile-painting";
87 const char kUIEnablePerTilePainting[] = "ui-enable-per-tile-painting";
89 // Renders a border around compositor layers to help debug and study
90 // layer compositing.
91 const char kShowCompositedLayerBorders[] = "show-composited-layer-borders";
92 const char kUIShowCompositedLayerBorders[] = "ui-show-layer-borders";
94 // Draws a FPS indicator
95 const char kShowFPSCounter[] = "show-fps-counter";
96 const char kUIShowFPSCounter[] = "ui-show-fps-counter";
98 // Show rects in the HUD around layers whose properties have changed.
99 const char kShowPropertyChangedRects[] = "show-property-changed-rects";
100 const char kUIShowPropertyChangedRects[] = "ui-show-property-changed-rects";
102 // Show rects in the HUD around damage as it is recorded into each render
103 // surface.
104 const char kShowSurfaceDamageRects[] = "show-surface-damage-rects";
105 const char kUIShowSurfaceDamageRects[] = "ui-show-surface-damage-rects";
107 // Show rects in the HUD around the screen-space transformed bounds of every
108 // layer.
109 const char kShowScreenSpaceRects[] = "show-screenspace-rects";
110 const char kUIShowScreenSpaceRects[] = "ui-show-screenspace-rects";
112 // Show rects in the HUD around the screen-space transformed bounds of every
113 // layer's replica, when they have one.
114 const char kShowReplicaScreenSpaceRects[] = "show-replica-screenspace-rects";
115 const char kUIShowReplicaScreenSpaceRects[] =
116 "ui-show-replica-screenspace-rects";
118 // Show rects in the HUD wherever something is known to be drawn opaque and is
119 // considered occluding the pixels behind it.
120 const char kShowOccludingRects[] = "show-occluding-rects";
121 const char kUIShowOccludingRects[] = "ui-show-occluding-rects";
123 // Show rects in the HUD wherever something is not known to be drawn opaque and
124 // is not considered to be occluding the pixels behind it.
125 const char kShowNonOccludingRects[] = "show-nonoccluding-rects";
126 const char kUIShowNonOccludingRects[] = "ui-show-nonoccluding-rects";
128 // Enable rasterizer that writes directly to GPU memory.
129 const char kEnableMapImage[] = "enable-map-image";
131 // Disable rasterizer that writes directly to GPU memory.
132 // Overrides the kEnableMapImage flag.
133 const char kDisableMapImage[] = "disable-map-image";
135 // Prevents the layer tree unit tests from timing out.
136 const char kCCLayerTreeTestNoTimeout[] = "cc-layer-tree-test-no-timeout";
138 bool IsImplSidePaintingEnabled() {
139 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
141 if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting))
142 return false;
143 else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting))
144 return true;
146 #if defined(OS_ANDROID)
147 return true;
148 #else
149 return false;
150 #endif
153 bool IsMapImageEnabled() {
154 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
156 if (command_line.HasSwitch(cc::switches::kDisableMapImage))
157 return false;
158 else if (command_line.HasSwitch(cc::switches::kEnableMapImage))
159 return true;
161 return false;
164 } // namespace switches
165 } // namespace cc