Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: cc/base/switches.cc

Issue 181063022: cc: Trigger GPU rasterization based on a per-layer hint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
29 31
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 // Select the location used for drawing layer tiles. Allowed values are
40 // the Skia GPU backend. Only valid with GPU accelerated compositing + 42 // 'cpu' (rasterize on the CPU only), 'gpu' (always use the Skia GPU backend
41 // impl-side painting. 43 // for rasterization), and 'hybrid' (use hints and heuristics to determine
42 const char kEnableGPURasterization[] = "enable-gpu-rasterization"; 44 // when to rasterize using the Skia GPU backend).
43 45 const char kRasterizationSite[] = "rasterization-site";
44 // Disable GPU rasterization, i.e. rasterize on the CPU only.
45 // Overrides the kEnableGPURasterization flag.
46 const char kDisableGPURasterization[] = "disable-gpu-rasterization";
47 46
48 // The height of the movable top controls. 47 // The height of the movable top controls.
49 const char kTopControlsHeight[] = "top-controls-height"; 48 const char kTopControlsHeight[] = "top-controls-height";
50 49
51 // Percentage of the top controls need to be hidden before they will auto hide. 50 // Percentage of the top controls need to be hidden before they will auto hide.
52 const char kTopControlsHideThreshold[] = "top-controls-hide-threshold"; 51 const char kTopControlsHideThreshold[] = "top-controls-hide-threshold";
53 52
54 // Percentage of the top controls need to be shown before they will auto show. 53 // Percentage of the top controls need to be shown before they will auto show.
55 const char kTopControlsShowThreshold[] = "top-controls-show-threshold"; 54 const char kTopControlsShowThreshold[] = "top-controls-show-threshold";
56 55
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 else if (command_line->HasSwitch(switches::kEnableLCDText)) 157 else if (command_line->HasSwitch(switches::kEnableLCDText))
159 return true; 158 return true;
160 159
161 #if defined(OS_ANDROID) 160 #if defined(OS_ANDROID)
162 return false; 161 return false;
163 #else 162 #else
164 return true; 163 return true;
165 #endif 164 #endif
166 } 165 }
167 166
167 bool IsHybridRasterizationEnabled() {
168 if (!IsImplSidePaintingEnabled())
169 return false;
170 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
171 std::string rasterization_site =
172 command_line.GetSwitchValueASCII(switches::kRasterizationSite);
173 return rasterization_site == "hybrid";
174 }
175
168 bool IsGpuRasterizationEnabled() { 176 bool IsGpuRasterizationEnabled() {
177 if (!IsImplSidePaintingEnabled())
178 return false;
piman 2014/03/06 22:13:53 I think all these flags and helper functions shoul
ernstm 2014/03/06 22:47:26 GPU rasterization can be enabled without setting -
169 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 179 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
170 180 std::string rasterization_site =
171 if (command_line.HasSwitch(switches::kDisableGPURasterization)) 181 command_line.GetSwitchValueASCII(switches::kRasterizationSite);
172 return false; 182 return rasterization_site == "gpu";
173 else if (command_line.HasSwitch(switches::kEnableGPURasterization))
174 return true;
175
176 return false;
177 } 183 }
178 184
179 bool IsImplSidePaintingEnabled() { 185 bool IsImplSidePaintingEnabled() {
180 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 186 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
181 187
182 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) 188 if (command_line.HasSwitch(switches::kDisableImplSidePainting))
183 return false; 189 return false;
184 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) 190 else if (command_line.HasSwitch(switches::kEnableImplSidePainting))
185 return true; 191 return true;
186 192
(...skipping 10 matching lines...) Expand all
197 if (command_line.HasSwitch(switches::kDisableMapImage)) 203 if (command_line.HasSwitch(switches::kDisableMapImage))
198 return false; 204 return false;
199 else if (command_line.HasSwitch(switches::kEnableMapImage)) 205 else if (command_line.HasSwitch(switches::kEnableMapImage))
200 return true; 206 return true;
201 207
202 return false; 208 return false;
203 } 209 }
204 210
205 } // namespace switches 211 } // namespace switches
206 } // namespace cc 212 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698