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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 565 |
563 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 566 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
564 layer_tree_host_->SetRootLayer( | 567 layer_tree_host_->SetRootLayer( |
565 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); | 568 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
566 } | 569 } |
567 | 570 |
568 void RenderWidgetCompositor::clearRootLayer() { | 571 void RenderWidgetCompositor::clearRootLayer() { |
569 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 572 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
570 } | 573 } |
571 | 574 |
| 575 void RenderWidgetCompositor::attachCompositorAnimationTimeline( |
| 576 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 577 DCHECK(compositor_timeline); |
| 578 DCHECK(layer_tree_host_->animation_host()); |
| 579 layer_tree_host_->animation_host()->AddAnimationTimeline( |
| 580 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 581 compositor_timeline)->animation_timeline()); |
| 582 } |
| 583 |
| 584 void RenderWidgetCompositor::detachCompositorAnimationTimeline( |
| 585 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 586 DCHECK(compositor_timeline); |
| 587 DCHECK(layer_tree_host_->animation_host()); |
| 588 layer_tree_host_->animation_host()->RemoveAnimationTimeline( |
| 589 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 590 compositor_timeline)->animation_timeline()); |
| 591 } |
| 592 |
572 void RenderWidgetCompositor::setViewportSize( | 593 void RenderWidgetCompositor::setViewportSize( |
573 const WebSize&, | 594 const WebSize&, |
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 } |
577 | 598 |
578 void RenderWidgetCompositor::setViewportSize( | 599 void RenderWidgetCompositor::setViewportSize( |
579 const WebSize& device_viewport_size) { | 600 const WebSize& device_viewport_size) { |
580 layer_tree_host_->SetViewportSize(device_viewport_size); | 601 layer_tree_host_->SetViewportSize(device_viewport_size); |
581 } | 602 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 cc::ContextProvider* provider = | 946 cc::ContextProvider* provider = |
926 compositor_deps_->GetSharedMainThreadContextProvider(); | 947 compositor_deps_->GetSharedMainThreadContextProvider(); |
927 // provider can be NULL after the GPU process crashed enough times and we | 948 // provider can be NULL after the GPU process crashed enough times and we |
928 // don't want to restart it any more (falling back to software). | 949 // don't want to restart it any more (falling back to software). |
929 if (!provider) | 950 if (!provider) |
930 return; | 951 return; |
931 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 952 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
932 } | 953 } |
933 | 954 |
934 } // namespace content | 955 } // namespace content |
OLD | NEW |