Mailbox support for texture layers.
[chromium-blink-merge.git] / cc / layer_tree_settings.cc
blobf8b964307a539c30527ac2d1701c903def2912a8
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"
7 #include <limits>
9 #include "base/command_line.h"
10 #include "base/logging.h"
11 #include "base/string_number_conversions.h"
12 #include "cc/switches.h"
14 namespace cc {
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)
27 , canUseLCDText(true)
28 , shouldClearRootRenderPass(true)
29 , useLinearFadeScrollbarAnimator(false)
30 , refreshRate(0)
31 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
32 , numRasterThreads(1)
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;
48 #endif
50 #if defined(OS_ANDROID)
51 // TODO(danakj): Move this out to the android code.
52 maxPartialTextureUpdates = 0;
53 #endif
55 #if defined(OS_ANDROID)
56 // TODO(danakj): Move this out to the android code.
57 useLinearFadeScrollbarAnimator = true;
58 #endif
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);
73 int num_threads;
74 if (base::StringToInt(num_raster_threads, &num_threads) &&
75 num_threads > 0 && num_threads <= kMaxRasterThreads) {
76 numRasterThreads = num_threads;
77 } else {
78 LOG(WARNING) << "Bad number of raster threads: " <<
79 num_raster_threads;
84 LayerTreeSettings::~LayerTreeSettings()
88 } // namespace cc