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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | |
9 #include "base/strings/string_number_conversions.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 |
17 // Disables LCD text. | 19 // Disables LCD text. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 #else | 181 #else |
180 return false; | 182 return false; |
181 #endif | 183 #endif |
182 } | 184 } |
183 | 185 |
184 bool CheckGPURasterizationStatus() { | 186 bool CheckGPURasterizationStatus() { |
185 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 187 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
186 return command_line.HasSwitch(switches::kEnableGPURasterization); | 188 return command_line.HasSwitch(switches::kEnableGPURasterization); |
187 } | 189 } |
188 | 190 |
191 size_t CheckNumRasterThreads() { | |
192 const int kMinRasterThreads = 1; | |
193 const int kMaxRasterThreads = 64; | |
194 const int kDefaultNumRasterThreads = 1; | |
195 | |
196 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
197 if (command_line.HasSwitch(switches::kNumRasterThreads)) { | |
198 std::string string_value = | |
199 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); | |
200 int num_threads = kDefaultNumRasterThreads; | |
201 if ((base::StringToInt(string_value, &num_threads) && | |
reveman
2013/12/30 08:57:06
just "(" instead of "(("
sohanjg
2013/12/30 09:18:55
Done.
| |
202 num_threads >= kMinRasterThreads && num_threads <= kMaxRasterThreads)) | |
reveman
2013/12/30 08:57:06
just ")" instead of "))"
sohanjg
2013/12/30 09:18:55
Done.
| |
203 return num_threads; | |
204 | |
205 LOG(WARNING) << "Failed to parse switch " << | |
206 switches::kNumRasterThreads << ": " << string_value; | |
207 } | |
208 return kDefaultNumRasterThreads; | |
209 } | |
210 | |
189 } // namespace | 211 } // namespace |
190 | 212 |
191 bool IsImplSidePaintingEnabled() { | 213 bool IsImplSidePaintingEnabled() { |
192 static bool enabled = CheckImplSidePaintingStatus(); | 214 static bool enabled = CheckImplSidePaintingStatus(); |
193 return enabled; | 215 return enabled; |
194 } | 216 } |
195 | 217 |
196 bool IsGPURasterizationEnabled() { | 218 bool IsGPURasterizationEnabled() { |
197 static bool enabled = CheckGPURasterizationStatus(); | 219 static bool enabled = CheckGPURasterizationStatus(); |
198 return enabled; | 220 return enabled; |
199 } | 221 } |
200 | 222 |
201 bool IsMapImageEnabled() { | 223 bool IsMapImageEnabled() { |
202 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 224 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
203 | 225 |
204 if (command_line.HasSwitch(switches::kDisableMapImage)) | 226 if (command_line.HasSwitch(switches::kDisableMapImage)) |
205 return false; | 227 return false; |
206 else if (command_line.HasSwitch(switches::kEnableMapImage)) | 228 else if (command_line.HasSwitch(switches::kEnableMapImage)) |
207 return true; | 229 return true; |
208 | 230 |
209 return false; | 231 return false; |
210 } | 232 } |
211 | 233 |
234 size_t GetNumRasterThreads() { | |
235 static size_t num_raster_threads = CheckNumRasterThreads(); | |
236 return num_raster_threads; | |
237 } | |
238 | |
212 } // namespace switches | 239 } // namespace switches |
213 } // namespace cc | 240 } // namespace cc |
OLD | NEW |