| Index: cc/base/switches.cc
|
| diff --git a/cc/base/switches.cc b/cc/base/switches.cc
|
| index 752abc607729186d3090c70a75c2e1c80610b949..a60d92c847bf1f0f782e1bf9570546ddc0809afd 100644
|
| --- a/cc/base/switches.cc
|
| +++ b/cc/base/switches.cc
|
| @@ -156,56 +156,75 @@ const char kDisable4444Textures[] = "disable-4444-textures";
|
| const char kDisableCompositorTouchHitTesting[] =
|
| "disable-compositor-touch-hit-testing";
|
|
|
| -bool IsLCDTextEnabled() {
|
| - const CommandLine* command_line = CommandLine::ForCurrentProcess();
|
| - if (command_line->HasSwitch(cc::switches::kDisableLCDText))
|
| - return false;
|
| - else if (command_line->HasSwitch(cc::switches::kEnableLCDText))
|
| - return true;
|
| -
|
| +static bool g_has_initialized_switches = false;
|
| +static bool g_impl_side_painting_enabled = false;
|
| +static bool g_map_image_enabled = false;
|
| +static bool g_lcd_text_enabled = false;
|
| +static bool g_gpu_rasterization_enabled = false;
|
| +
|
| +static void InitializeSwitchesIfNeeded() {
|
| + if (!g_has_initialized_switches) {
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| + // Impl-side painting.
|
| + if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting)) {
|
| + g_impl_side_painting_enabled = false;
|
| + } else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting)) {
|
| + g_impl_side_painting_enabled = true;
|
| + } else {
|
| #if defined(OS_ANDROID)
|
| - return false;
|
| + g_impl_side_painting_enabled = true;
|
| #else
|
| - return true;
|
| + g_impl_side_painting_enabled = false;
|
| #endif
|
| -}
|
| -
|
| -namespace {
|
| -bool CheckImplSidePaintingStatus() {
|
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| -
|
| - if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting))
|
| - return false;
|
| - else if (command_line.HasSwitch(cc::switches::kEnableImplSidePainting))
|
| - return true;
|
| -
|
| + }
|
| +
|
| + // Map-Image.
|
| + if (command_line.HasSwitch(cc::switches::kDisableMapImage))
|
| + g_map_image_enabled = false;
|
| + else if (command_line.HasSwitch(cc::switches::kEnableMapImage))
|
| + g_map_image_enabled = true;
|
| + else
|
| + g_map_image_enabled = false;
|
| +
|
| + // LCD-Text.
|
| + if (command_line.HasSwitch(cc::switches::kDisableLCDText)) {
|
| + g_lcd_text_enabled = false;
|
| + } else if (command_line.HasSwitch(cc::switches::kEnableLCDText)) {
|
| + g_lcd_text_enabled = true;
|
| + } else {
|
| #if defined(OS_ANDROID)
|
| - return true;
|
| + g_lcd_text_enabled = false;
|
| #else
|
| - return false;
|
| + g_lcd_text_enabled = true;
|
| #endif
|
| + }
|
| +
|
| + // GPU Rasterization.
|
| + if(command_line.HasSwitch(cc::switches::kEnableGPURasterization)) {
|
| + g_gpu_rasterization_enabled = true;
|
| + }
|
| + g_has_initialized_switches = true;
|
| + }
|
| }
|
| -} // namespace
|
|
|
| bool IsImplSidePaintingEnabled() {
|
| - static bool enabled = CheckImplSidePaintingStatus();
|
| - return enabled;
|
| + InitializeSwitchesIfNeeded();
|
| + return g_impl_side_painting_enabled;
|
| }
|
|
|
| bool IsGPURasterizationEnabled() {
|
| - const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| - return command_line.HasSwitch(cc::switches::kEnableGPURasterization);
|
| + InitializeSwitchesIfNeeded();
|
| + return g_gpu_rasterization_enabled;
|
| }
|
|
|
| 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;
|
| + InitializeSwitchesIfNeeded();
|
| + return g_map_image_enabled;
|
| +}
|
|
|
| - return false;
|
| +bool IsLCDTextEnabled() {
|
| + InitializeSwitchesIfNeeded();
|
| + return g_lcd_text_enabled;
|
| }
|
|
|
| } // namespace switches
|
|
|