| 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 "config.h" | 5 #include "config.h" | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
| 8 #include "CCSettings.h" | 8 #include "cc/settings.h" | 
| 9 #include "cc/switches.h" | 9 #include "cc/switches.h" | 
| 10 | 10 | 
| 11 namespace { | 11 namespace { | 
|  | 12 static bool s_settingsInitialized = false; | 
|  | 13 | 
| 12 static bool s_perTilePaintingEnabled = false; | 14 static bool s_perTilePaintingEnabled = false; | 
| 13 static bool s_partialSwapEnabled = false; | 15 static bool s_partialSwapEnabled = false; | 
| 14 static bool s_acceleratedAnimationEnabled = false; | 16 static bool s_acceleratedAnimationEnabled = false; | 
| 15 static bool s_pageScalePinchZoomEnabled = false; | 17 static bool s_pageScalePinchZoomEnabled = false; | 
| 16 } // namespace | 18 static bool s_jankInsteadOfCheckerboard = false; | 
|  | 19 static bool s_backgroundColorInsteadOfCheckerboard = false; | 
|  | 20 | 
|  | 21 void reset() | 
|  | 22 { | 
|  | 23     s_settingsInitialized = true; | 
|  | 24 | 
|  | 25     s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s
     witches::kEnablePerTilePainting); | 
|  | 26     s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc
     hes::kEnablePartialSwap); | 
|  | 27     s_acceleratedAnimationEnabled = CommandLine::ForCurrentProcess()->HasSwitch(
     cc::switches::kDisableThreadedAnimation); | 
|  | 28     s_pageScalePinchZoomEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc
     ::switches::kEnablePinchInCompositor); | 
|  | 29     s_jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(cc
     ::switches::kJankInsteadOfCheckerboard); | 
|  | 30     s_backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->H
     asSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); | 
|  | 31 } | 
|  | 32 | 
|  | 33 } | 
| 17 | 34 | 
| 18 namespace cc { | 35 namespace cc { | 
| 19 | 36 | 
| 20 bool CCSettings::perTilePaintingEnabled() { return s_perTilePaintingEnabled; } | 37 bool Settings::perTilePaintingEnabled() | 
| 21 void CCSettings::setPerTilePaintingEnabled(bool enabled) { s_perTilePaintingEnab
     led = enabled; } |  | 
| 22 |  | 
| 23 bool CCSettings::partialSwapEnabled() { return s_partialSwapEnabled; } |  | 
| 24 void CCSettings::setPartialSwapEnabled(bool enabled) { s_partialSwapEnabled = en
     abled; } |  | 
| 25 |  | 
| 26 bool CCSettings::acceleratedAnimationEnabled() { return s_acceleratedAnimationEn
     abled; } |  | 
| 27 void CCSettings::setAcceleratedAnimationEnabled(bool enabled) { s_acceleratedAni
     mationEnabled = enabled; } |  | 
| 28 |  | 
| 29 bool CCSettings::pageScalePinchZoomEnabled() { return s_pageScalePinchZoomEnable
     d; } |  | 
| 30 void CCSettings::setPageScalePinchZoomEnabled(bool enabled) { s_pageScalePinchZo
     omEnabled = enabled; } |  | 
| 31 |  | 
| 32 bool CCSettings::jankInsteadOfCheckerboard() |  | 
| 33 { | 38 { | 
| 34     return CommandLine::ForCurrentProcess()->HasSwitch(switches::kJankInsteadOfC
     heckerboard); | 39     if (!s_settingsInitialized) | 
|  | 40         reset(); | 
|  | 41     return s_perTilePaintingEnabled; | 
| 35 } | 42 } | 
| 36 | 43 | 
| 37 bool CCSettings::backgroundColorInsteadOfCheckerboard() | 44 bool Settings::partialSwapEnabled() | 
| 38 { | 45 { | 
| 39     return CommandLine::ForCurrentProcess()->HasSwitch(switches::kBackgroundColo
     rInsteadOfCheckerboard); | 46     if (!s_settingsInitialized) | 
|  | 47         reset(); | 
|  | 48     return s_partialSwapEnabled; | 
| 40 } | 49 } | 
| 41 | 50 | 
| 42 void CCSettings::reset() | 51 bool Settings::acceleratedAnimationEnabled() | 
| 43 { | 52 { | 
| 44     s_perTilePaintingEnabled = false; | 53     if (!s_settingsInitialized) | 
| 45     s_partialSwapEnabled = false; | 54         reset(); | 
| 46     s_acceleratedAnimationEnabled = false; | 55     return s_acceleratedAnimationEnabled; | 
| 47     s_pageScalePinchZoomEnabled = false; | 56 } | 
|  | 57 | 
|  | 58 bool Settings::pageScalePinchZoomEnabled() | 
|  | 59 { | 
|  | 60     if (!s_settingsInitialized) | 
|  | 61         reset(); | 
|  | 62     return s_pageScalePinchZoomEnabled; | 
|  | 63 } | 
|  | 64 | 
|  | 65 bool Settings::jankInsteadOfCheckerboard() | 
|  | 66 { | 
|  | 67     if (!s_settingsInitialized) | 
|  | 68         reset(); | 
|  | 69     return s_jankInsteadOfCheckerboard; | 
|  | 70 } | 
|  | 71 | 
|  | 72 bool Settings::backgroundColorInsteadOfCheckerboard() | 
|  | 73 { | 
|  | 74     if (!s_settingsInitialized) | 
|  | 75         reset(); | 
|  | 76     return s_backgroundColorInsteadOfCheckerboard; | 
|  | 77 } | 
|  | 78 | 
|  | 79 void Settings::resetForTest() | 
|  | 80 { | 
|  | 81     reset(); | 
|  | 82 } | 
|  | 83 | 
|  | 84 void Settings::setPartialSwapEnabled(bool enabled) | 
|  | 85 { | 
|  | 86     if (!s_settingsInitialized) | 
|  | 87         reset(); | 
|  | 88     s_partialSwapEnabled = enabled; | 
|  | 89 } | 
|  | 90 | 
|  | 91 void Settings::setPerTilePaintingEnabled(bool enabled) | 
|  | 92 { | 
|  | 93     if (!s_settingsInitialized) | 
|  | 94         reset(); | 
|  | 95     s_partialSwapEnabled = enabled; | 
|  | 96 } | 
|  | 97 | 
|  | 98 void Settings::setAcceleratedAnimationEnabled(bool enabled) | 
|  | 99 { | 
|  | 100     if (!s_settingsInitialized) | 
|  | 101         reset(); | 
|  | 102     s_acceleratedAnimationEnabled = enabled; | 
|  | 103 } | 
|  | 104 | 
|  | 105 void Settings::setPageScalePinchZoomEnabled(bool enabled) | 
|  | 106 { | 
|  | 107     if (!s_settingsInitialized) | 
|  | 108         reset(); | 
|  | 109     s_pageScalePinchZoomEnabled = enabled; | 
| 48 } | 110 } | 
| 49 | 111 | 
| 50 } // namespace cc | 112 } // namespace cc | 
| OLD | NEW | 
|---|