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