Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: cc/settings.cc

Issue 11361223: cc: Remove cc::settings, move them to LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using WebLayerTreeSettings for things WebKit can set Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_jankInsteadOfCheckerboard = false;
17 static bool s_backgroundColorInsteadOfCheckerboard = false;
18 static bool s_traceOverdraw = false;
19
20 void reset()
21 {
22 s_settingsInitialized = true;
23
24 s_perTilePaintingEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::s witches::kEnablePerTilePainting);
25 s_partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc hes::kEnablePartialSwap);
26 s_acceleratedAnimationEnabled = !CommandLine::ForCurrentProcess()->HasSwitch (cc::switches::kDisableThreadedAnimation);
27 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);
30 s_traceOverdraw = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:: kTraceOverdraw);
31 }
32
33 }
34
35 namespace cc {
36
37 bool Settings::perTilePaintingEnabled()
38 {
39 if (!s_settingsInitialized)
40 reset();
41 return s_perTilePaintingEnabled;
42 }
43
44 bool Settings::partialSwapEnabled()
45 {
46 if (!s_settingsInitialized)
47 reset();
48 return s_partialSwapEnabled;
49 }
50
51 bool Settings::acceleratedAnimationEnabled()
52 {
53 if (!s_settingsInitialized)
54 reset();
55 return s_acceleratedAnimationEnabled;
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 bool Settings::traceOverdraw()
80 {
81 if (!s_settingsInitialized)
82 reset();
83 return s_traceOverdraw;
84 }
85
86 void Settings::resetForTest()
87 {
88 reset();
89 }
90
91 void Settings::setPartialSwapEnabled(bool enabled)
92 {
93 if (!s_settingsInitialized)
94 reset();
95 s_partialSwapEnabled = enabled;
96 }
97
98 void Settings::setPerTilePaintingEnabled(bool enabled)
99 {
100 if (!s_settingsInitialized)
101 reset();
102 s_partialSwapEnabled = enabled;
103 }
104
105 void Settings::setAcceleratedAnimationEnabled(bool enabled)
106 {
107 if (!s_settingsInitialized)
108 reset();
109 s_acceleratedAnimationEnabled = enabled;
110 }
111
112 void Settings::setPageScalePinchZoomEnabled(bool enabled)
113 {
114 if (!s_settingsInitialized)
115 reset();
116 s_pageScalePinchZoomEnabled = enabled;
117 }
118
119 } // namespace cc
OLDNEW
« cc/layer_tree_host.cc ('K') | « cc/settings.h ('k') | cc/software_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698