Chromium Code Reviews| Index: cc/base/switches.cc |
| diff --git a/cc/base/switches.cc b/cc/base/switches.cc |
| index be4a2c55adfbcb22214a0a92439f59da8fd112e2..8cd9e82abded07ad20e119175f21b01695e95203 100644 |
| --- a/cc/base/switches.cc |
| +++ b/cc/base/switches.cc |
| @@ -165,37 +165,47 @@ bool IsLCDTextEnabled() { |
| #endif |
| } |
| -namespace { |
| -bool CheckImplSidePaintingStatus() { |
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| +// impl side painting |
|
danakj
2013/11/11 17:57:53
The variable is called impl_side_painting, so I do
|
| +static bool implSidePaintingStatus; |
|
danakj
2013/11/11 17:57:53
this is blink style, you want g_impl_side_painting
|
| +// map-image flag |
|
danakj
2013/11/11 17:57:53
same with this comment
|
| +static bool mapImageStatus; |
| - if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting)) |
| - return false; |
| - else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting)) |
| - return true; |
| +static void InitializeCCSwitchesIfRequired() { |
| + static bool has_initialized_ccswitches = false; |
| + if (has_initialized_ccswitches) |
| + return; |
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| + // impl-side painting |
|
danakj
2013/11/11 17:57:53
// Impl-side painting.
(capitals and punctuation
|
| + if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting)) { |
| + implSidePaintingStatus = false; |
| + } else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting)) { |
| + implSidePaintingStatus = true; |
| + } else { |
| #if defined(OS_ANDROID) |
| - return true; |
| + implSidePaintingStatus = true; |
| #else |
| - return false; |
| + implSidePaintingStatus = false; |
| #endif |
| + } |
| + |
| + // map-image flag |
|
danakj
2013/11/11 17:57:53
// Map-image flag.
|
| + if (command_line.HasSwitch(cc::switches::kDisableMapImage)) |
| + mapImageStatus = false; |
| + else if (command_line.HasSwitch(cc::switches::kEnableMapImage)) |
| + mapImageStatus = true; |
| + |
| + has_initialized_ccswitches = true; |
| } |
| -} // namespace |
| bool IsImplSidePaintingEnabled() { |
| - static bool enabled = CheckImplSidePaintingStatus(); |
| - return enabled; |
| + InitializeCCSwitchesIfRequired(); |
| + return implSidePaintingStatus; |
| } |
| bool IsMapImageEnabled() { |
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| - |
| - if (command_line.HasSwitch(cc::switches::kDisableMapImage)) |
| - return false; |
| - else if (command_line.HasSwitch(cc::switches::kEnableMapImage)) |
| - return true; |
| - |
| - return false; |
| + InitializeCCSwitchesIfRequired(); |
| + return mapImageStatus; |
| } |
| } // namespace switches |