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 , compositorFrameMessage(false) | 18 , compositorFrameMessage(false) |
19 , implSidePainting(false) | 19 , implSidePainting(false) |
20 , renderVSyncEnabled(true) | 20 , renderVSyncEnabled(true) |
21 , perTilePaintingEnabled(false) | 21 , perTilePaintingEnabled(false) |
22 , partialSwapEnabled(false) | 22 , partialSwapEnabled(false) |
23 , acceleratedAnimationEnabled(true) | 23 , acceleratedAnimationEnabled(true) |
24 , pageScalePinchZoomEnabled(false) | 24 , pageScalePinchZoomEnabled(false) |
25 , backgroundColorInsteadOfCheckerboard(false) | 25 , backgroundColorInsteadOfCheckerboard(false) |
26 , showOverdrawInTracing(false) | 26 , showOverdrawInTracing(false) |
27 , canUseLCDText(true) | 27 , canUseLCDText(true) |
28 , shouldClearRootRenderPass(true) | 28 , shouldClearRootRenderPass(true) |
| 29 , useLinearFadeScrollbarAnimator(false) |
29 , refreshRate(0) | 30 , refreshRate(0) |
30 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 31 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
31 , numRasterThreads(1) | 32 , numRasterThreads(1) |
32 , defaultTileSize(gfx::Size(256, 256)) | 33 , defaultTileSize(gfx::Size(256, 256)) |
33 , maxUntiledLayerSize(gfx::Size(512, 512)) | 34 , maxUntiledLayerSize(gfx::Size(512, 512)) |
34 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | 35 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
35 { | 36 { |
36 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | 37 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. |
37 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi
tches::kEnableCompositorFrameMessage); | 38 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi
tches::kEnableCompositorFrameMessage); |
38 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | 39 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); |
39 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | 40 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); |
40 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | 41 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); |
41 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | 42 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); |
42 | 43 |
43 // TODO(alokp): Remove this hard-coded setting. | 44 // TODO(alokp): Remove this hard-coded setting. |
44 // Platforms that need to disable LCD text must explicitly set this value. | 45 // Platforms that need to disable LCD text must explicitly set this value. |
45 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
46 canUseLCDText = false; | 47 canUseLCDText = false; |
47 #endif | 48 #endif |
48 | 49 |
| 50 #if defined(OS_ANDROID) |
| 51 // TODO(danakj): Move this out to the android code. |
| 52 maxPartialTextureUpdates = 0; |
| 53 #endif |
| 54 |
| 55 #if defined(OS_ANDROID) |
| 56 // TODO(danakj): Move this out to the android code. |
| 57 useLinearFadeScrollbarAnimator = true; |
| 58 #endif |
| 59 |
49 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | 60 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); |
50 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | 61 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); |
51 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | 62 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); |
52 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | 63 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
53 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | 64 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); |
54 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | 65 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); |
55 | 66 |
56 if (CommandLine::ForCurrentProcess()->HasSwitch( | 67 if (CommandLine::ForCurrentProcess()->HasSwitch( |
57 switches::kNumRasterThreads)) { | 68 switches::kNumRasterThreads)) { |
58 const size_t kMaxRasterThreads = 64; | 69 const size_t kMaxRasterThreads = 64; |
59 std::string num_raster_threads = | 70 std::string num_raster_threads = |
60 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 71 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
61 switches::kNumRasterThreads); | 72 switches::kNumRasterThreads); |
62 int num_threads; | 73 int num_threads; |
63 if (base::StringToInt(num_raster_threads, &num_threads) && | 74 if (base::StringToInt(num_raster_threads, &num_threads) && |
64 num_threads > 0 && num_threads <= kMaxRasterThreads) { | 75 num_threads > 0 && num_threads <= kMaxRasterThreads) { |
65 numRasterThreads = num_threads; | 76 numRasterThreads = num_threads; |
66 } else { | 77 } else { |
67 LOG(WARNING) << "Bad number of raster threads: " << | 78 LOG(WARNING) << "Bad number of raster threads: " << |
68 num_raster_threads; | 79 num_raster_threads; |
69 } | 80 } |
70 } | 81 } |
71 } | 82 } |
72 | 83 |
73 LayerTreeSettings::~LayerTreeSettings() | 84 LayerTreeSettings::~LayerTreeSettings() |
74 { | 85 { |
75 } | 86 } |
76 | 87 |
77 } // namespace cc | 88 } // namespace cc |
OLD | NEW |