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
3 // found in the LICENSE file.
5 #include "cc/layer_tree_settings.h"
9 #include "base/command_line.h"
10 #include "base/logging.h"
11 #include "base/string_number_conversions.h"
12 #include "cc/switches.h"
16 LayerTreeSettings::LayerTreeSettings()
17 : acceleratePainting(false)
18 , compositorFrameMessage(false)
19 , implSidePainting(false)
20 , renderVSyncEnabled(true)
21 , perTilePaintingEnabled(false)
22 , partialSwapEnabled(false)
23 , acceleratedAnimationEnabled(true)
24 , pageScalePinchZoomEnabled(false)
25 , backgroundColorInsteadOfCheckerboard(false)
26 , showOverdrawInTracing(false)
28 , shouldClearRootRenderPass(true)
29 , useLinearFadeScrollbarAnimator(false)
31 , maxPartialTextureUpdates(std::numeric_limits
<size_t>::max())
33 , defaultTileSize(gfx::Size(256, 256))
34 , maxUntiledLayerSize(gfx::Size(512, 512))
35 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
37 // TODO(danakj): Move this to chromium when we don't go through the WebKit API anymore.
38 compositorFrameMessage
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kEnableCompositorFrameMessage
);
39 implSidePainting
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kEnableImplSidePainting
);
40 partialSwapEnabled
= CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePartialSwap
);
41 backgroundColorInsteadOfCheckerboard
= CommandLine::ForCurrentProcess()->HasSwitch(switches::kBackgroundColorInsteadOfCheckerboard
);
42 showOverdrawInTracing
= CommandLine::ForCurrentProcess()->HasSwitch(switches::kTraceOverdraw
);
44 // TODO(alokp): Remove this hard-coded setting.
45 // Platforms that need to disable LCD text must explicitly set this value.
46 #if defined(OS_ANDROID)
47 canUseLCDText
= false;
50 #if defined(OS_ANDROID)
51 // TODO(danakj): Move this out to the android code.
52 maxPartialTextureUpdates
= 0;
55 #if defined(OS_ANDROID)
56 // TODO(danakj): Move this out to the android code.
57 useLinearFadeScrollbarAnimator
= true;
60 initialDebugState
.showPropertyChangedRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowPropertyChangedRects
);
61 initialDebugState
.showSurfaceDamageRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowSurfaceDamageRects
);
62 initialDebugState
.showScreenSpaceRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowScreenSpaceRects
);
63 initialDebugState
.showReplicaScreenSpaceRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects
);
64 initialDebugState
.showOccludingRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowOccludingRects
);
65 initialDebugState
.showNonOccludingRects
= CommandLine::ForCurrentProcess()->HasSwitch(cc::switches::kShowNonOccludingRects
);
67 if (CommandLine::ForCurrentProcess()->HasSwitch(
68 switches::kNumRasterThreads
)) {
69 const size_t kMaxRasterThreads
= 64;
70 std::string num_raster_threads
=
71 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
72 switches::kNumRasterThreads
);
74 if (base::StringToInt(num_raster_threads
, &num_threads
) &&
75 num_threads
> 0 && num_threads
<= kMaxRasterThreads
) {
76 numRasterThreads
= num_threads
;
78 LOG(WARNING
) << "Bad number of raster threads: " <<
84 LayerTreeSettings::~LayerTreeSettings()