| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/base/switches.h" | 5 #include "cc/base/switches.h" |
| 6 | 6 |
| 7 #include <string> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 | 10 |
| 9 namespace cc { | 11 namespace cc { |
| 10 namespace switches { | 12 namespace switches { |
| 11 | 13 |
| 12 // On platforms where checkerboards are used, prefer background colors instead | 14 // On platforms where checkerboards are used, prefer background colors instead |
| 13 // of checkerboards. | 15 // of checkerboards. |
| 14 const char kBackgroundColorInsteadOfCheckerboard[] = | 16 const char kBackgroundColorInsteadOfCheckerboard[] = |
| 15 "background-color-instead-of-checkerboard"; | 17 "background-color-instead-of-checkerboard"; |
| 16 | 18 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 // Enables LCD text. | 32 // Enables LCD text. |
| 31 const char kEnableLCDText[] = "enable-lcd-text"; | 33 const char kEnableLCDText[] = "enable-lcd-text"; |
| 32 | 34 |
| 33 // Paint content on the compositor thread instead of the main thread. | 35 // Paint content on the compositor thread instead of the main thread. |
| 34 const char kEnableImplSidePainting[] = "enable-impl-side-painting"; | 36 const char kEnableImplSidePainting[] = "enable-impl-side-painting"; |
| 35 | 37 |
| 36 const char kEnableTopControlsPositionCalculation[] = | 38 const char kEnableTopControlsPositionCalculation[] = |
| 37 "enable-top-controls-position-calculation"; | 39 "enable-top-controls-position-calculation"; |
| 38 | 40 |
| 39 // Allow heuristics to determine when a layer tile should be drawn with | 41 // Allow heuristics to determine when a layer tile should be drawn with |
| 40 // the Skia GPU backend. Only valid with GPU accelerated compositing + | 42 // a Skia GPU backend. The backend can be selected explicitly by |
| 41 // impl-side painting. | 43 // appending "={gpu,msaa4,msaa16}". |
| 44 // Only valid with GPU accelerated compositing + impl-side painting. |
| 42 const char kEnableGPURasterization[] = "enable-gpu-rasterization"; | 45 const char kEnableGPURasterization[] = "enable-gpu-rasterization"; |
| 43 | 46 |
| 44 // Disable GPU rasterization, i.e. rasterize on the CPU only. | 47 // Disable GPU rasterization, i.e. rasterize on the CPU only. |
| 45 // Overrides the kEnableGPURasterization flag. | 48 // Overrides the kEnableGPURasterization flag. |
| 46 const char kDisableGPURasterization[] = "disable-gpu-rasterization"; | 49 const char kDisableGPURasterization[] = "disable-gpu-rasterization"; |
| 47 | 50 |
| 48 // The height of the movable top controls. | 51 // The height of the movable top controls. |
| 49 const char kTopControlsHeight[] = "top-controls-height"; | 52 const char kTopControlsHeight[] = "top-controls-height"; |
| 50 | 53 |
| 51 // Percentage of the top controls need to be hidden before they will auto hide. | 54 // Percentage of the top controls need to be hidden before they will auto hide. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 172 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 170 | 173 |
| 171 if (command_line.HasSwitch(switches::kDisableGPURasterization)) | 174 if (command_line.HasSwitch(switches::kDisableGPURasterization)) |
| 172 return false; | 175 return false; |
| 173 else if (command_line.HasSwitch(switches::kEnableGPURasterization)) | 176 else if (command_line.HasSwitch(switches::kEnableGPURasterization)) |
| 174 return true; | 177 return true; |
| 175 | 178 |
| 176 return false; | 179 return false; |
| 177 } | 180 } |
| 178 | 181 |
| 182 GpuRasterizationType GetGpuRasterizationType() { |
| 183 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 184 |
| 185 std::string type = |
| 186 command_line.GetSwitchValueASCII(switches::kEnableGPURasterization); |
| 187 if (type == "msaa4") |
| 188 return GpuRasterizationMsaa4; |
| 189 else if (type == "msaa16") |
| 190 return GpuRasterizationMsaa4; |
| 191 |
| 192 return GpuRasterizationGpu; |
| 193 } |
| 194 |
| 179 bool IsImplSidePaintingEnabled() { | 195 bool IsImplSidePaintingEnabled() { |
| 180 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 196 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 181 | 197 |
| 182 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) | 198 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) |
| 183 return false; | 199 return false; |
| 184 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) | 200 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) |
| 185 return true; | 201 return true; |
| 186 | 202 |
| 187 #if defined(OS_ANDROID) | 203 #if defined(OS_ANDROID) |
| 188 return true; | 204 return true; |
| 189 #else | 205 #else |
| 190 return false; | 206 return false; |
| 191 #endif | 207 #endif |
| 192 } | 208 } |
| 193 | 209 |
| 194 bool IsMapImageEnabled() { | 210 bool IsMapImageEnabled() { |
| 195 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 211 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 196 | 212 |
| 197 if (command_line.HasSwitch(switches::kDisableMapImage)) | 213 if (command_line.HasSwitch(switches::kDisableMapImage)) |
| 198 return false; | 214 return false; |
| 199 else if (command_line.HasSwitch(switches::kEnableMapImage)) | 215 else if (command_line.HasSwitch(switches::kEnableMapImage)) |
| 200 return true; | 216 return true; |
| 201 | 217 |
| 202 return false; | 218 return false; |
| 203 } | 219 } |
| 204 | 220 |
| 205 } // namespace switches | 221 } // namespace switches |
| 206 } // namespace cc | 222 } // namespace cc |
| OLD | NEW |