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; | |
17 static bool s_backgroundColorInsteadOfCheckerboard = false; | 16 static bool s_backgroundColorInsteadOfCheckerboard = false; |
18 static bool s_traceOverdraw = false; | 17 static bool s_traceOverdraw = false; |
19 | 18 |
20 void reset() | 19 void reset() |
21 { | 20 { |
22 s_settingsInitialized = true; | 21 s_settingsInitialized = true; |
23 | 22 |
24 s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s
witches::kEnablePerTilePainting); | 23 s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s
witches::kEnablePerTilePainting); |
25 s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc
hes::kEnablePartialSwap); | 24 s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc
hes::kEnablePartialSwap); |
26 s_acceleratedAnimationEnabled = !CommandLine::ForCurrentProcess()->HasSwitch
(cc::switches::kDisableThreadedAnimation); | 25 s_acceleratedAnimationEnabled = !CommandLine::ForCurrentProcess()->HasSwitch
(cc::switches::kDisableThreadedAnimation); |
27 s_pageScalePinchZoomEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kEnablePinchInCompositor); | 26 s_pageScalePinchZoomEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kEnablePinchInCompositor); |
28 s_jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(cc
::switches::kJankInsteadOfCheckerboard); | |
29 s_backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); | 27 s_backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); |
30 s_traceOverdraw = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::
kTraceOverdraw); | 28 s_traceOverdraw = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::
kTraceOverdraw); |
31 } | 29 } |
32 | 30 |
33 } | 31 } |
34 | 32 |
35 namespace cc { | 33 namespace cc { |
36 | 34 |
37 bool Settings::perTilePaintingEnabled() | 35 bool Settings::perTilePaintingEnabled() |
38 { | 36 { |
(...skipping 16 matching lines...) Expand all Loading... |
55 return s_acceleratedAnimationEnabled; | 53 return s_acceleratedAnimationEnabled; |
56 } | 54 } |
57 | 55 |
58 bool Settings::pageScalePinchZoomEnabled() | 56 bool Settings::pageScalePinchZoomEnabled() |
59 { | 57 { |
60 if (!s_settingsInitialized) | 58 if (!s_settingsInitialized) |
61 reset(); | 59 reset(); |
62 return s_pageScalePinchZoomEnabled; | 60 return s_pageScalePinchZoomEnabled; |
63 } | 61 } |
64 | 62 |
65 bool Settings::jankInsteadOfCheckerboard() | |
66 { | |
67 if (!s_settingsInitialized) | |
68 reset(); | |
69 return s_jankInsteadOfCheckerboard; | |
70 } | |
71 | |
72 bool Settings::backgroundColorInsteadOfCheckerboard() | 63 bool Settings::backgroundColorInsteadOfCheckerboard() |
73 { | 64 { |
74 if (!s_settingsInitialized) | 65 if (!s_settingsInitialized) |
75 reset(); | 66 reset(); |
76 return s_backgroundColorInsteadOfCheckerboard; | 67 return s_backgroundColorInsteadOfCheckerboard; |
77 } | 68 } |
78 | 69 |
79 bool Settings::traceOverdraw() | 70 bool Settings::traceOverdraw() |
80 { | 71 { |
81 if (!s_settingsInitialized) | 72 if (!s_settingsInitialized) |
(...skipping 28 matching lines...) Expand all Loading... |
110 } | 101 } |
111 | 102 |
112 void Settings::setPageScalePinchZoomEnabled(bool enabled) | 103 void Settings::setPageScalePinchZoomEnabled(bool enabled) |
113 { | 104 { |
114 if (!s_settingsInitialized) | 105 if (!s_settingsInitialized) |
115 reset(); | 106 reset(); |
116 s_pageScalePinchZoomEnabled = enabled; | 107 s_pageScalePinchZoomEnabled = enabled; |
117 } | 108 } |
118 | 109 |
119 } // namespace cc | 110 } // namespace cc |
OLD | NEW |