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