| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "cc/animation/animation_timeline.h" |
| 17 #include "cc/base/latency_info_swap_promise.h" | 18 #include "cc/base/latency_info_swap_promise.h" |
| 18 #include "cc/base/latency_info_swap_promise_monitor.h" | 19 #include "cc/base/latency_info_swap_promise_monitor.h" |
| 19 #include "cc/base/swap_promise.h" | 20 #include "cc/base/swap_promise.h" |
| 20 #include "cc/base/switches.h" | 21 #include "cc/base/switches.h" |
| 22 #include "cc/blink/web_compositor_animation_timeline_impl.h" |
| 21 #include "cc/blink/web_layer_impl.h" | 23 #include "cc/blink/web_layer_impl.h" |
| 22 #include "cc/debug/layer_tree_debug_state.h" | 24 #include "cc/debug/layer_tree_debug_state.h" |
| 23 #include "cc/debug/micro_benchmark.h" | 25 #include "cc/debug/micro_benchmark.h" |
| 24 #include "cc/input/layer_selection_bound.h" | 26 #include "cc/input/layer_selection_bound.h" |
| 25 #include "cc/layers/layer.h" | 27 #include "cc/layers/layer.h" |
| 26 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
| 27 #include "cc/output/copy_output_request.h" | 29 #include "cc/output/copy_output_request.h" |
| 28 #include "cc/output/copy_output_result.h" | 30 #include "cc/output/copy_output_result.h" |
| 29 #include "cc/resources/single_release_callback.h" | 31 #include "cc/resources/single_release_callback.h" |
| 30 #include "cc/scheduler/begin_frame_source.h" | 32 #include "cc/scheduler/begin_frame_source.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 561 |
| 560 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 562 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
| 561 layer_tree_host_->SetRootLayer( | 563 layer_tree_host_->SetRootLayer( |
| 562 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); | 564 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
| 563 } | 565 } |
| 564 | 566 |
| 565 void RenderWidgetCompositor::clearRootLayer() { | 567 void RenderWidgetCompositor::clearRootLayer() { |
| 566 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 568 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
| 567 } | 569 } |
| 568 | 570 |
| 571 void RenderWidgetCompositor::setCompositorAnimationTimeline( |
| 572 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 573 layer_tree_host_->SetAnimationTimeline( |
| 574 compositor_timeline |
| 575 ? static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 576 compositor_timeline)->animation_timeline() |
| 577 : scoped_refptr<cc::AnimationTimeline>()); |
| 578 } |
| 579 |
| 569 void RenderWidgetCompositor::setViewportSize( | 580 void RenderWidgetCompositor::setViewportSize( |
| 570 const WebSize&, | 581 const WebSize&, |
| 571 const WebSize& device_viewport_size) { | 582 const WebSize& device_viewport_size) { |
| 572 layer_tree_host_->SetViewportSize(device_viewport_size); | 583 layer_tree_host_->SetViewportSize(device_viewport_size); |
| 573 } | 584 } |
| 574 | 585 |
| 575 void RenderWidgetCompositor::setViewportSize( | 586 void RenderWidgetCompositor::setViewportSize( |
| 576 const WebSize& device_viewport_size) { | 587 const WebSize& device_viewport_size) { |
| 577 layer_tree_host_->SetViewportSize(device_viewport_size); | 588 layer_tree_host_->SetViewportSize(device_viewport_size); |
| 578 } | 589 } |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 cc::ContextProvider* provider = | 922 cc::ContextProvider* provider = |
| 912 compositor_deps_->GetSharedMainThreadContextProvider(); | 923 compositor_deps_->GetSharedMainThreadContextProvider(); |
| 913 // provider can be NULL after the GPU process crashed enough times and we | 924 // provider can be NULL after the GPU process crashed enough times and we |
| 914 // don't want to restart it any more (falling back to software). | 925 // don't want to restart it any more (falling back to software). |
| 915 if (!provider) | 926 if (!provider) |
| 916 return; | 927 return; |
| 917 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 928 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 918 } | 929 } |
| 919 | 930 |
| 920 } // namespace content | 931 } // namespace content |
| OLD | NEW |