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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 574 |
572 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 575 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
573 layer_tree_host_->SetRootLayer( | 576 layer_tree_host_->SetRootLayer( |
574 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); | 577 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
575 } | 578 } |
576 | 579 |
577 void RenderWidgetCompositor::clearRootLayer() { | 580 void RenderWidgetCompositor::clearRootLayer() { |
578 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 581 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
579 } | 582 } |
580 | 583 |
| 584 void RenderWidgetCompositor::attachCompositorAnimationTimeline( |
| 585 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 586 DCHECK(compositor_timeline); |
| 587 DCHECK(layer_tree_host_->animation_host()); |
| 588 layer_tree_host_->animation_host()->AddAnimationTimeline( |
| 589 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 590 compositor_timeline)->animation_timeline()); |
| 591 } |
| 592 |
| 593 void RenderWidgetCompositor::detachCompositorAnimationTimeline( |
| 594 blink::WebCompositorAnimationTimeline* compositor_timeline) { |
| 595 DCHECK(compositor_timeline); |
| 596 DCHECK(layer_tree_host_->animation_host()); |
| 597 layer_tree_host_->animation_host()->RemoveAnimationTimeline( |
| 598 static_cast<const cc_blink::WebCompositorAnimationTimelineImpl*>( |
| 599 compositor_timeline)->animation_timeline()); |
| 600 } |
| 601 |
581 void RenderWidgetCompositor::setViewportSize( | 602 void RenderWidgetCompositor::setViewportSize( |
582 const WebSize&, | 603 const WebSize&, |
583 const WebSize& device_viewport_size) { | 604 const WebSize& device_viewport_size) { |
584 layer_tree_host_->SetViewportSize(device_viewport_size); | 605 layer_tree_host_->SetViewportSize(device_viewport_size); |
585 } | 606 } |
586 | 607 |
587 void RenderWidgetCompositor::setViewportSize( | 608 void RenderWidgetCompositor::setViewportSize( |
588 const WebSize& device_viewport_size) { | 609 const WebSize& device_viewport_size) { |
589 layer_tree_host_->SetViewportSize(device_viewport_size); | 610 layer_tree_host_->SetViewportSize(device_viewport_size); |
590 } | 611 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 cc::ContextProvider* provider = | 957 cc::ContextProvider* provider = |
937 compositor_deps_->GetSharedMainThreadContextProvider(); | 958 compositor_deps_->GetSharedMainThreadContextProvider(); |
938 // provider can be NULL after the GPU process crashed enough times and we | 959 // 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). | 960 // don't want to restart it any more (falling back to software). |
940 if (!provider) | 961 if (!provider) |
941 return; | 962 return; |
942 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 963 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
943 } | 964 } |
944 | 965 |
945 } // namespace content | 966 } // namespace content |
OLD | NEW |