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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 settings.throttle_frame_production = | 225 settings.throttle_frame_production = |
226 !cmd->HasSwitch(switches::kDisableGpuVsync); | 226 !cmd->HasSwitch(switches::kDisableGpuVsync); |
227 settings.main_frame_before_activation_enabled = | 227 settings.main_frame_before_activation_enabled = |
228 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && | 228 cmd->HasSwitch(cc::switches::kEnableMainFrameBeforeActivation) && |
229 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); | 229 !cmd->HasSwitch(cc::switches::kDisableMainFrameBeforeActivation); |
230 settings.report_overscroll_only_for_scrollable_axes = | 230 settings.report_overscroll_only_for_scrollable_axes = |
231 !compositor_deps_->IsElasticOverscrollEnabled(); | 231 !compositor_deps_->IsElasticOverscrollEnabled(); |
232 settings.accelerated_animation_enabled = | 232 settings.accelerated_animation_enabled = |
233 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); | 233 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); |
234 settings.use_display_lists = cmd->HasSwitch(switches::kEnableSlimmingPaint); | 234 settings.use_display_lists = cmd->HasSwitch(switches::kEnableSlimmingPaint); |
235 if (cmd->HasSwitch(switches::kEnableCompositorAnimationTimelines)) { | |
236 settings.use_compositor_animation_timelines = true; | |
237 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); | |
238 } | |
239 if (cmd->HasSwitch(switches::kEnableBeginFrameScheduling) && | 235 if (cmd->HasSwitch(switches::kEnableBeginFrameScheduling) && |
240 !widget_->for_oopif()) { | 236 !widget_->for_oopif()) { |
241 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 237 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
242 // See crbug.com/471411. | 238 // See crbug.com/471411. |
243 settings.use_external_begin_frame_source = true; | 239 settings.use_external_begin_frame_source = true; |
244 } | 240 } |
245 | 241 |
246 settings.default_tile_size = CalculateDefaultTileSize(widget_); | 242 settings.default_tile_size = CalculateDefaultTileSize(widget_); |
247 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { | 243 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { |
248 int tile_width = 0; | 244 int tile_width = 0; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 669 } |
674 | 670 |
675 bool RenderWidgetCompositor::commitRequested() const { | 671 bool RenderWidgetCompositor::commitRequested() const { |
676 return layer_tree_host_->CommitRequested(); | 672 return layer_tree_host_->CommitRequested(); |
677 } | 673 } |
678 | 674 |
679 void RenderWidgetCompositor::didStopFlinging() { | 675 void RenderWidgetCompositor::didStopFlinging() { |
680 layer_tree_host_->DidStopFlinging(); | 676 layer_tree_host_->DidStopFlinging(); |
681 } | 677 } |
682 | 678 |
683 void RenderWidgetCompositor::registerForAnimations(blink::WebLayer* layer) { | |
684 cc::Layer* cc_layer = static_cast<cc_blink::WebLayerImpl*>(layer)->layer(); | |
685 cc_layer->RegisterForAnimations(layer_tree_host_->animation_registrar(), | |
686 layer_tree_host_->settings()); | |
687 } | |
688 | |
689 void RenderWidgetCompositor::registerViewportLayers( | 679 void RenderWidgetCompositor::registerViewportLayers( |
690 const blink::WebLayer* overscrollElasticityLayer, | 680 const blink::WebLayer* overscrollElasticityLayer, |
691 const blink::WebLayer* pageScaleLayer, | 681 const blink::WebLayer* pageScaleLayer, |
692 const blink::WebLayer* innerViewportScrollLayer, | 682 const blink::WebLayer* innerViewportScrollLayer, |
693 const blink::WebLayer* outerViewportScrollLayer) { | 683 const blink::WebLayer* outerViewportScrollLayer) { |
694 layer_tree_host_->RegisterViewportLayers( | 684 layer_tree_host_->RegisterViewportLayers( |
695 // The scroll elasticity layer will only exist when using pinch virtual | 685 // The scroll elasticity layer will only exist when using pinch virtual |
696 // viewports. | 686 // viewports. |
697 overscrollElasticityLayer | 687 overscrollElasticityLayer |
698 ? static_cast<const cc_blink::WebLayerImpl*>( | 688 ? static_cast<const cc_blink::WebLayerImpl*>( |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 cc::ContextProvider* provider = | 947 cc::ContextProvider* provider = |
958 compositor_deps_->GetSharedMainThreadContextProvider(); | 948 compositor_deps_->GetSharedMainThreadContextProvider(); |
959 // provider can be NULL after the GPU process crashed enough times and we | 949 // provider can be NULL after the GPU process crashed enough times and we |
960 // don't want to restart it any more (falling back to software). | 950 // don't want to restart it any more (falling back to software). |
961 if (!provider) | 951 if (!provider) |
962 return; | 952 return; |
963 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 953 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
964 } | 954 } |
965 | 955 |
966 } // namespace content | 956 } // namespace content |
OLD | NEW |