OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/layer_tree_settings.h" | 5 #include "cc/layer_tree_settings.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "cc/switches.h" | 12 #include "cc/switches.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 LayerTreeSettings::LayerTreeSettings() | 16 LayerTreeSettings::LayerTreeSettings() |
17 : acceleratePainting(false) | 17 : acceleratePainting(false) |
18 , implSidePainting(false) | 18 , implSidePainting(false) |
19 , renderVSyncEnabled(true) | 19 , renderVSyncEnabled(true) |
20 , perTilePaintingEnabled(false) | 20 , perTilePaintingEnabled(false) |
21 , partialSwapEnabled(false) | 21 , partialSwapEnabled(false) |
22 , acceleratedAnimationEnabled(true) | 22 , acceleratedAnimationEnabled(true) |
23 , pageScalePinchZoomEnabled(false) | 23 , pageScalePinchZoomEnabled(false) |
24 , backgroundColorInsteadOfCheckerboard(false) | 24 , backgroundColorInsteadOfCheckerboard(false) |
25 , showOverdrawInTracing(false) | 25 , showOverdrawInTracing(false) |
| 26 , canUseLCDText(true) |
26 , refreshRate(0) | 27 , refreshRate(0) |
27 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 28 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
28 , numRasterThreads(1) | 29 , numRasterThreads(1) |
29 , defaultTileSize(gfx::Size(256, 256)) | 30 , defaultTileSize(gfx::Size(256, 256)) |
30 , maxUntiledLayerSize(gfx::Size(512, 512)) | 31 , maxUntiledLayerSize(gfx::Size(512, 512)) |
31 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | 32 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
32 { | 33 { |
33 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | 34 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. |
34 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | 35 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); |
35 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | 36 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); |
36 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | 37 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); |
37 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | 38 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); |
38 | 39 |
| 40 // TODO(alokp): Remove this hard-coded setting. |
| 41 // Platforms that need to disable LCD text must explicitly set this value. |
| 42 #if defined(OS_ANDROID) |
| 43 canUseLCDText = false; |
| 44 #endif |
| 45 |
39 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | 46 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); |
40 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | 47 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); |
41 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | 48 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); |
42 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | 49 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
43 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | 50 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); |
44 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | 51 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); |
45 | 52 |
46 if (CommandLine::ForCurrentProcess()->HasSwitch( | 53 if (CommandLine::ForCurrentProcess()->HasSwitch( |
47 switches::kNumRasterThreads)) { | 54 switches::kNumRasterThreads)) { |
48 const size_t kMaxRasterThreads = 64; | 55 const size_t kMaxRasterThreads = 64; |
49 std::string num_raster_threads = | 56 std::string num_raster_threads = |
50 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 57 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
51 switches::kNumRasterThreads); | 58 switches::kNumRasterThreads); |
52 int num_threads; | 59 int num_threads; |
53 if (base::StringToInt(num_raster_threads, &num_threads) && | 60 if (base::StringToInt(num_raster_threads, &num_threads) && |
54 num_threads > 0 && num_threads <= kMaxRasterThreads) { | 61 num_threads > 0 && num_threads <= kMaxRasterThreads) { |
55 numRasterThreads = num_threads; | 62 numRasterThreads = num_threads; |
56 } else { | 63 } else { |
57 LOG(WARNING) << "Bad number of raster threads: " << | 64 LOG(WARNING) << "Bad number of raster threads: " << |
58 num_raster_threads; | 65 num_raster_threads; |
59 } | 66 } |
60 } | 67 } |
61 } | 68 } |
62 | 69 |
63 LayerTreeSettings::~LayerTreeSettings() | 70 LayerTreeSettings::~LayerTreeSettings() |
64 { | 71 { |
65 } | 72 } |
66 | 73 |
67 } // namespace cc | 74 } // namespace cc |
OLD | NEW |