OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 214 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
215 | 215 |
216 cc::LayerTreeSettings settings; | 216 cc::LayerTreeSettings settings; |
217 | 217 |
218 // For web contents, layer transforms should scale up the contents of layers | 218 // For web contents, layer transforms should scale up the contents of layers |
219 // to keep content always crisp when possible. | 219 // to keep content always crisp when possible. |
220 settings.layer_transforms_should_scale_layer_contents = true; | 220 settings.layer_transforms_should_scale_layer_contents = true; |
221 | 221 |
222 settings.throttle_frame_production = | 222 settings.throttle_frame_production = |
223 !cmd->HasSwitch(switches::kDisableGpuVsync); | 223 !cmd->HasSwitch(switches::kDisableGpuVsync); |
224 settings.use_external_begin_frame_source = | |
225 cmd->HasSwitch(switches::kEnableBeginFrameScheduling); | |
226 settings.main_frame_before_activation_enabled = | 224 settings.main_frame_before_activation_enabled = |
227 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && | 225 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && |
228 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); | 226 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); |
229 settings.report_overscroll_only_for_scrollable_axes = | 227 settings.report_overscroll_only_for_scrollable_axes = |
230 !compositor_deps_->IsElasticOverscrollEnabled(); | 228 !compositor_deps_->IsElasticOverscrollEnabled(); |
231 settings.accelerated_animation_enabled = | 229 settings.accelerated_animation_enabled = |
232 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); | 230 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); |
233 settings.use_display_lists = cmd->HasSwitch(switches::kEnableSlimmingPaint); | 231 settings.use_display_lists = cmd->HasSwitch(switches::kEnableSlimmingPaint); |
234 if (cmd->HasSwitch(switches::kEnableCompositorAnimationTimelines)) { | 232 if (cmd->HasSwitch(switches::kEnableCompositorAnimationTimelines)) { |
235 settings.use_compositor_animation_timelines = true; | 233 settings.use_compositor_animation_timelines = true; |
236 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); | 234 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); |
237 } | 235 } |
| 236 if (cmd->HasSwitch(switches::kEnableBeginFrameScheduling) && |
| 237 !widget_->for_oopif()) { |
| 238 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
| 239 // See crbug.com/471411. |
| 240 settings.use_external_begin_frame_source = true; |
| 241 } |
238 | 242 |
239 settings.default_tile_size = CalculateDefaultTileSize(widget_); | 243 settings.default_tile_size = CalculateDefaultTileSize(widget_); |
240 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { | 244 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { |
241 int tile_width = 0; | 245 int tile_width = 0; |
242 GetSwitchValueAsInt(*cmd, | 246 GetSwitchValueAsInt(*cmd, |
243 switches::kDefaultTileWidth, | 247 switches::kDefaultTileWidth, |
244 1, | 248 1, |
245 std::numeric_limits<int>::max(), | 249 std::numeric_limits<int>::max(), |
246 &tile_width); | 250 &tile_width); |
247 settings.default_tile_size.set_width(tile_width); | 251 settings.default_tile_size.set_width(tile_width); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 cc::ContextProvider* provider = | 940 cc::ContextProvider* provider = |
937 compositor_deps_->GetSharedMainThreadContextProvider(); | 941 compositor_deps_->GetSharedMainThreadContextProvider(); |
938 // provider can be NULL after the GPU process crashed enough times and we | 942 // provider can be NULL after the GPU process crashed enough times and we |
939 // don't want to restart it any more (falling back to software). | 943 // don't want to restart it any more (falling back to software). |
940 if (!provider) | 944 if (!provider) |
941 return; | 945 return; |
942 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 946 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
943 } | 947 } |
944 | 948 |
945 } // namespace content | 949 } // namespace content |
OLD | NEW |