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/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "cc/animation/animation_host.h" |
| 19 #include "cc/animation/animation_timeline.h" |
18 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 21 #include "cc/blink/web_compositor_animation_timeline_impl.h" |
19 #include "cc/blink/web_layer_impl.h" | 22 #include "cc/blink/web_layer_impl.h" |
20 #include "cc/debug/layer_tree_debug_state.h" | 23 #include "cc/debug/layer_tree_debug_state.h" |
21 #include "cc/debug/micro_benchmark.h" | 24 #include "cc/debug/micro_benchmark.h" |
22 #include "cc/input/layer_selection_bound.h" | 25 #include "cc/input/layer_selection_bound.h" |
23 #include "cc/layers/layer.h" | 26 #include "cc/layers/layer.h" |
24 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
25 #include "cc/output/copy_output_request.h" | 28 #include "cc/output/copy_output_request.h" |
26 #include "cc/output/copy_output_result.h" | 29 #include "cc/output/copy_output_result.h" |
27 #include "cc/output/latency_info_swap_promise.h" | 30 #include "cc/output/latency_info_swap_promise.h" |
28 #include "cc/output/swap_promise.h" | 31 #include "cc/output/swap_promise.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 560 |
558 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 561 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
559 layer_tree_host_->SetRootLayer( | 562 layer_tree_host_->SetRootLayer( |
560 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); | 563 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
561 } | 564 } |
562 | 565 |
563 void RenderWidgetCompositor::clearRootLayer() { | 566 void RenderWidgetCompositor::clearRootLayer() { |
564 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 567 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
565 } | 568 } |
566 | 569 |
| 570 void RenderWidgetCompositor::attachCompositorAnimationTimeline( |
| 571 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 572 DCHECK(compositor_timeline); |
| 573 DCHECK(layer_tree_host_->animation_host()); |
| 574 layer_tree_host_->animation_host()->AddAnimationTimeline( |
| 575 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 576 compositor_timeline)->animation_timeline()); |
| 577 } |
| 578 |
| 579 void RenderWidgetCompositor::detachCompositorAnimationTimeline( |
| 580 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 581 DCHECK(compositor_timeline); |
| 582 DCHECK(layer_tree_host_->animation_host()); |
| 583 layer_tree_host_->animation_host()->RemoveAnimationTimeline( |
| 584 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 585 compositor_timeline)->animation_timeline()); |
| 586 } |
| 587 |
567 void RenderWidgetCompositor::setViewportSize( | 588 void RenderWidgetCompositor::setViewportSize( |
568 const WebSize&, | 589 const WebSize&, |
569 const WebSize& device_viewport_size) { | 590 const WebSize& device_viewport_size) { |
570 layer_tree_host_->SetViewportSize(device_viewport_size); | 591 layer_tree_host_->SetViewportSize(device_viewport_size); |
571 } | 592 } |
572 | 593 |
573 void RenderWidgetCompositor::setViewportSize( | 594 void RenderWidgetCompositor::setViewportSize( |
574 const WebSize& device_viewport_size) { | 595 const WebSize& device_viewport_size) { |
575 layer_tree_host_->SetViewportSize(device_viewport_size); | 596 layer_tree_host_->SetViewportSize(device_viewport_size); |
576 } | 597 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 cc::ContextProvider* provider = | 941 cc::ContextProvider* provider = |
921 compositor_deps_->GetSharedMainThreadContextProvider(); | 942 compositor_deps_->GetSharedMainThreadContextProvider(); |
922 // provider can be NULL after the GPU process crashed enough times and we | 943 // provider can be NULL after the GPU process crashed enough times and we |
923 // don't want to restart it any more (falling back to software). | 944 // don't want to restart it any more (falling back to software). |
924 if (!provider) | 945 if (!provider) |
925 return; | 946 return; |
926 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 947 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
927 } | 948 } |
928 | 949 |
929 } // namespace content | 950 } // namespace content |
OLD | NEW |