| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "cc/settings.h" | 6 #include "cc/settings.h" |
| 7 #include "cc/switches.h" | 7 #include "cc/switches.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 static bool s_settingsInitialized = false; | 10 static bool s_settingsInitialized = false; |
| 11 | 11 |
| 12 static bool s_perTilePaintingEnabled = false; | 12 static bool s_perTilePaintingEnabled = false; |
| 13 static bool s_partialSwapEnabled = false; | 13 static bool s_partialSwapEnabled = false; |
| 14 static bool s_acceleratedAnimationEnabled = false; | 14 static bool s_acceleratedAnimationEnabled = false; |
| 15 static bool s_pageScalePinchZoomEnabled = false; | 15 static bool s_pageScalePinchZoomEnabled = false; |
| 16 static bool s_jankInsteadOfCheckerboard = false; | 16 static bool s_jankInsteadOfCheckerboard = false; |
| 17 static bool s_backgroundColorInsteadOfCheckerboard = false; | 17 static bool s_backgroundColorInsteadOfCheckerboard = false; |
| 18 static bool s_traceOverdraw = false; |
| 18 | 19 |
| 19 void reset() | 20 void reset() |
| 20 { | 21 { |
| 21 s_settingsInitialized = true; | 22 s_settingsInitialized = true; |
| 22 | 23 |
| 23 s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s
witches::kEnablePerTilePainting); | 24 s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s
witches::kEnablePerTilePainting); |
| 24 s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc
hes::kEnablePartialSwap); | 25 s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc
hes::kEnablePartialSwap); |
| 25 s_acceleratedAnimationEnabled = !CommandLine::ForCurrentProcess()->HasSwitch
(cc::switches::kDisableThreadedAnimation); | 26 s_acceleratedAnimationEnabled = !CommandLine::ForCurrentProcess()->HasSwitch
(cc::switches::kDisableThreadedAnimation); |
| 26 s_pageScalePinchZoomEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kEnablePinchInCompositor); | 27 s_pageScalePinchZoomEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kEnablePinchInCompositor); |
| 27 s_jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kJankInsteadOfCheckerboard); | 28 s_jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kJankInsteadOfCheckerboard); |
| 28 s_backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); | 29 s_backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); |
| 30 s_traceOverdraw = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::
kTraceOverdraw); |
| 29 } | 31 } |
| 30 | 32 |
| 31 } | 33 } |
| 32 | 34 |
| 33 namespace cc { | 35 namespace cc { |
| 34 | 36 |
| 35 bool Settings::perTilePaintingEnabled() | 37 bool Settings::perTilePaintingEnabled() |
| 36 { | 38 { |
| 37 if (!s_settingsInitialized) | 39 if (!s_settingsInitialized) |
| 38 reset(); | 40 reset(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 return s_jankInsteadOfCheckerboard; | 69 return s_jankInsteadOfCheckerboard; |
| 68 } | 70 } |
| 69 | 71 |
| 70 bool Settings::backgroundColorInsteadOfCheckerboard() | 72 bool Settings::backgroundColorInsteadOfCheckerboard() |
| 71 { | 73 { |
| 72 if (!s_settingsInitialized) | 74 if (!s_settingsInitialized) |
| 73 reset(); | 75 reset(); |
| 74 return s_backgroundColorInsteadOfCheckerboard; | 76 return s_backgroundColorInsteadOfCheckerboard; |
| 75 } | 77 } |
| 76 | 78 |
| 79 bool Settings::traceOverdraw() |
| 80 { |
| 81 if (!s_settingsInitialized) |
| 82 reset(); |
| 83 return s_traceOverdraw; |
| 84 } |
| 85 |
| 77 void Settings::resetForTest() | 86 void Settings::resetForTest() |
| 78 { | 87 { |
| 79 reset(); | 88 reset(); |
| 80 } | 89 } |
| 81 | 90 |
| 82 void Settings::setPartialSwapEnabled(bool enabled) | 91 void Settings::setPartialSwapEnabled(bool enabled) |
| 83 { | 92 { |
| 84 if (!s_settingsInitialized) | 93 if (!s_settingsInitialized) |
| 85 reset(); | 94 reset(); |
| 86 s_partialSwapEnabled = enabled; | 95 s_partialSwapEnabled = enabled; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 101 } | 110 } |
| 102 | 111 |
| 103 void Settings::setPageScalePinchZoomEnabled(bool enabled) | 112 void Settings::setPageScalePinchZoomEnabled(bool enabled) |
| 104 { | 113 { |
| 105 if (!s_settingsInitialized) | 114 if (!s_settingsInitialized) |
| 106 reset(); | 115 reset(); |
| 107 s_pageScalePinchZoomEnabled = enabled; | 116 s_pageScalePinchZoomEnabled = enabled; |
| 108 } | 117 } |
| 109 | 118 |
| 110 } // namespace cc | 119 } // namespace cc |
| OLD | NEW |