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_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" |
10 #include "cc/font_atlas.h" | 11 #include "cc/font_atlas.h" |
11 #include "cc/graphics_context.h" | 12 #include "cc/graphics_context.h" |
12 #include "cc/heads_up_display_layer.h" | 13 #include "cc/heads_up_display_layer.h" |
13 #include "cc/heads_up_display_layer_impl.h" | 14 #include "cc/heads_up_display_layer_impl.h" |
14 #include "cc/layer.h" | 15 #include "cc/layer.h" |
15 #include "cc/layer_animation_controller.h" | 16 #include "cc/layer_animation_controller.h" |
16 #include "cc/layer_iterator.h" | 17 #include "cc/layer_iterator.h" |
17 #include "cc/layer_tree_host_client.h" | 18 #include "cc/layer_tree_host_client.h" |
18 #include "cc/layer_tree_host_common.h" | 19 #include "cc/layer_tree_host_common.h" |
19 #include "cc/layer_tree_host_impl.h" | 20 #include "cc/layer_tree_host_impl.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 , implSidePainting(false) | 99 , implSidePainting(false) |
99 , renderVSyncEnabled(true) | 100 , renderVSyncEnabled(true) |
100 , perTilePaintingEnabled(false) | 101 , perTilePaintingEnabled(false) |
101 , partialSwapEnabled(false) | 102 , partialSwapEnabled(false) |
102 , acceleratedAnimationEnabled(true) | 103 , acceleratedAnimationEnabled(true) |
103 , pageScalePinchZoomEnabled(false) | 104 , pageScalePinchZoomEnabled(false) |
104 , backgroundColorInsteadOfCheckerboard(false) | 105 , backgroundColorInsteadOfCheckerboard(false) |
105 , showOverdrawInTracing(false) | 106 , showOverdrawInTracing(false) |
106 , refreshRate(0) | 107 , refreshRate(0) |
107 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 108 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
| 109 , numRasterThreads(1) |
108 , defaultTileSize(gfx::Size(256, 256)) | 110 , defaultTileSize(gfx::Size(256, 256)) |
109 , maxUntiledLayerSize(gfx::Size(512, 512)) | 111 , maxUntiledLayerSize(gfx::Size(512, 512)) |
110 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | 112 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
111 { | 113 { |
112 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | 114 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. |
113 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | 115 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); |
114 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | 116 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); |
115 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | 117 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); |
116 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | 118 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); |
117 | 119 |
118 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | 120 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); |
119 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | 121 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); |
120 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | 122 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); |
121 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | 123 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
122 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | 124 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); |
123 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | 125 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); |
| 126 |
| 127 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 128 switches::kNumRasterThreads)) { |
| 129 const size_t kMaxRasterThreads = 64; |
| 130 std::string num_raster_threads = |
| 131 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 132 switches::kNumRasterThreads); |
| 133 int num_threads; |
| 134 if (base::StringToInt(num_raster_threads, &num_threads) && |
| 135 num_threads > 0 && num_threads <= kMaxRasterThreads) { |
| 136 numRasterThreads = num_threads; |
| 137 } else { |
| 138 LOG(WARNING) << "Bad number of raster threads: " << |
| 139 num_raster_threads; |
| 140 } |
| 141 } |
124 } | 142 } |
125 | 143 |
126 LayerTreeSettings::~LayerTreeSettings() | 144 LayerTreeSettings::~LayerTreeSettings() |
127 { | 145 { |
128 } | 146 } |
129 | 147 |
130 RendererCapabilities::RendererCapabilities() | 148 RendererCapabilities::RendererCapabilities() |
131 : bestTextureFormat(0) | 149 : bestTextureFormat(0) |
132 , contextHasCachedFrontBuffer(false) | 150 , contextHasCachedFrontBuffer(false) |
133 , usingPartialSwap(false) | 151 , usingPartialSwap(false) |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 else | 963 else |
946 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 964 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
947 } | 965 } |
948 } | 966 } |
949 | 967 |
950 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 968 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
951 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 969 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
952 } | 970 } |
953 | 971 |
954 } // namespace cc | 972 } // namespace cc |
OLD | NEW |