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 const char kDisableThreadedAnimation[] = "disable-threaded-animation"; 18 19 // Disables layer-edge anti-aliasing in the compositor. 20 const char kDisableCompositedAntialiasing[] = 21 "disable-composited-antialiasing"; 22 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"; 26 27 // Paint content on the compositor thread instead of the main thread. 28 const char kEnableImplSidePainting[] = "enable-impl-side-painting"; 29 30 const char kEnableTopControlsPositionCalculation[] = 31 "enable-top-controls-position-calculation"; 32 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"; 37 38 // The height of the movable top controls. 39 const char kTopControlsHeight[] = "top-controls-height"; 40 41 // Percentage of the top controls need to be hidden before they will auto hide. 42 const char kTopControlsHideThreshold[] = "top-controls-hide-threshold"; 43 44 // Percentage of the top controls need to be shown before they will auto show. 45 const char kTopControlsShowThreshold[] = "top-controls-show-threshold"; 46 47 // Number of worker threads used to rasterize content. 48 const char kNumRasterThreads[] = "num-raster-threads"; 49 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"; 53 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"; 58 59 // The scale factor for low resolution tile contents. 60 const char kLowResolutionContentsScaleFactor[] = 61 "low-resolution-contents-scale-factor"; 62 63 // Max tiles allowed for each tilings interest area. 64 const char kMaxTilesForInterestArea[] = "max-tiles-for-interest-area"; 65 66 // The amount of unused resource memory compositor is allowed to keep around. 67 const char kMaxUnusedResourceMemoryUsagePercentage[] = 68 "max-unused-resource-memory-usage-percentage"; 69 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"; 74 75 // Check that property changes during paint do not occur. 76 const char kStrictLayerPropertyChangeChecking[] = 77 "strict-layer-property-change-checking"; 78 79 // Virtual viewport for fixed-position elements, scrollbars during pinch. 80 const char kEnablePinchVirtualViewport[] = "enable-pinch-virtual-viewport"; 81 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"; 85 86 const char kEnablePerTilePainting[] = "enable-per-tile-painting"; 87 const char kUIEnablePerTilePainting[] = "ui-enable-per-tile-painting"; 88 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"; 93 94 // Draws a FPS indicator 95 const char kShowFPSCounter[] = "show-fps-counter"; 96 const char kUIShowFPSCounter[] = "ui-show-fps-counter"; 97 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"; 101 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"; 106 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"; 111 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"; 117 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"; 122 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"; 127 128 // Enable the codepath that uses images within TileManager. 129 const char kUseMapImage[] = "use-map-image"; 130 131 // Prevents the layer tree unit tests from timing out. 132 const char kCCLayerTreeTestNoTimeout[] = "cc-layer-tree-test-no-timeout"; 133 134 // Disable touch hit testing in the compositor. 135 const char kDisableCompositorTouchHitTesting[] = 136 "disable-compositor-touch-hit-testing"; 137 138 bool IsImplSidePaintingEnabled() { 139 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 140 141 if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting)) 142 return false; 143 else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting)) 144 return true; 145 146 #if defined(OS_ANDROID) 147 return true; 148 #else 149 return false; 150 #endif 151 } 152 153 } // namespace switches 154 } // namespace cc 155