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/base/latency_info_swap_promise.h" | 17 #include "cc/base/latency_info_swap_promise.h" |
18 #include "cc/base/latency_info_swap_promise_monitor.h" | 18 #include "cc/base/latency_info_swap_promise_monitor.h" |
19 #include "cc/base/swap_promise.h" | 19 #include "cc/base/swap_promise.h" |
20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 21 #include "cc/blink/web_layer_impl.h" |
21 #include "cc/debug/layer_tree_debug_state.h" | 22 #include "cc/debug/layer_tree_debug_state.h" |
22 #include "cc/debug/micro_benchmark.h" | 23 #include "cc/debug/micro_benchmark.h" |
23 #include "cc/input/layer_selection_bound.h" | 24 #include "cc/input/layer_selection_bound.h" |
24 #include "cc/layers/layer.h" | 25 #include "cc/layers/layer.h" |
25 #include "cc/output/begin_frame_args.h" | 26 #include "cc/output/begin_frame_args.h" |
26 #include "cc/output/copy_output_request.h" | 27 #include "cc/output/copy_output_request.h" |
27 #include "cc/output/copy_output_result.h" | 28 #include "cc/output/copy_output_result.h" |
28 #include "cc/resources/single_release_callback.h" | 29 #include "cc/resources/single_release_callback.h" |
29 #include "cc/trees/layer_tree_host.h" | 30 #include "cc/trees/layer_tree_host.h" |
30 #include "content/child/child_shared_bitmap_manager.h" | 31 #include "content/child/child_shared_bitmap_manager.h" |
31 #include "content/common/content_switches_internal.h" | 32 #include "content/common/content_switches_internal.h" |
32 #include "content/common/gpu/client/context_provider_command_buffer.h" | 33 #include "content/common/gpu/client/context_provider_command_buffer.h" |
33 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
34 #include "content/renderer/compositor_bindings/web_layer_impl.h" | |
35 #include "content/renderer/input/input_handler_manager.h" | 35 #include "content/renderer/input/input_handler_manager.h" |
36 #include "content/renderer/render_thread_impl.h" | 36 #include "content/renderer/render_thread_impl.h" |
37 #include "gpu/command_buffer/client/gles2_interface.h" | 37 #include "gpu/command_buffer/client/gles2_interface.h" |
38 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 38 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
39 #include "third_party/WebKit/public/platform/WebSelectionBound.h" | 39 #include "third_party/WebKit/public/platform/WebSelectionBound.h" |
40 #include "third_party/WebKit/public/platform/WebSize.h" | 40 #include "third_party/WebKit/public/platform/WebSize.h" |
41 #include "third_party/WebKit/public/web/WebWidget.h" | 41 #include "third_party/WebKit/public/web/WebWidget.h" |
42 #include "ui/gfx/frame_time.h" | 42 #include "ui/gfx/frame_time.h" |
43 #include "ui/gl/gl_switches.h" | 43 #include "ui/gl/gl_switches.h" |
44 #include "ui/native_theme/native_theme_switches.h" | 44 #include "ui/native_theme/native_theme_switches.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 } | 545 } |
546 DCHECK(layer_tree_host_); | 546 DCHECK(layer_tree_host_); |
547 } | 547 } |
548 | 548 |
549 void RenderWidgetCompositor::setSurfaceReady() { | 549 void RenderWidgetCompositor::setSurfaceReady() { |
550 layer_tree_host_->SetLayerTreeHostClientReady(); | 550 layer_tree_host_->SetLayerTreeHostClientReady(); |
551 } | 551 } |
552 | 552 |
553 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { | 553 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
554 layer_tree_host_->SetRootLayer( | 554 layer_tree_host_->SetRootLayer( |
555 static_cast<const WebLayerImpl*>(&layer)->layer()); | 555 static_cast<const cc_blink::WebLayerImpl*>(&layer)->layer()); |
556 } | 556 } |
557 | 557 |
558 void RenderWidgetCompositor::clearRootLayer() { | 558 void RenderWidgetCompositor::clearRootLayer() { |
559 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 559 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
560 } | 560 } |
561 | 561 |
562 void RenderWidgetCompositor::setViewportSize( | 562 void RenderWidgetCompositor::setViewportSize( |
563 const WebSize&, | 563 const WebSize&, |
564 const WebSize& device_viewport_size) { | 564 const WebSize& device_viewport_size) { |
565 layer_tree_host_->SetViewportSize(device_viewport_size); | 565 layer_tree_host_->SetViewportSize(device_viewport_size); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 bool RenderWidgetCompositor::commitRequested() const { | 639 bool RenderWidgetCompositor::commitRequested() const { |
640 return layer_tree_host_->CommitRequested(); | 640 return layer_tree_host_->CommitRequested(); |
641 } | 641 } |
642 | 642 |
643 void RenderWidgetCompositor::didStopFlinging() { | 643 void RenderWidgetCompositor::didStopFlinging() { |
644 layer_tree_host_->DidStopFlinging(); | 644 layer_tree_host_->DidStopFlinging(); |
645 } | 645 } |
646 | 646 |
647 void RenderWidgetCompositor::registerForAnimations(blink::WebLayer* layer) { | 647 void RenderWidgetCompositor::registerForAnimations(blink::WebLayer* layer) { |
648 cc::Layer* cc_layer = static_cast<WebLayerImpl*>(layer)->layer(); | 648 cc::Layer* cc_layer = static_cast<cc_blink::WebLayerImpl*>(layer)->layer(); |
649 cc_layer->layer_animation_controller()->SetAnimationRegistrar( | 649 cc_layer->layer_animation_controller()->SetAnimationRegistrar( |
650 layer_tree_host_->animation_registrar()); | 650 layer_tree_host_->animation_registrar()); |
651 } | 651 } |
652 | 652 |
653 void RenderWidgetCompositor::registerViewportLayers( | 653 void RenderWidgetCompositor::registerViewportLayers( |
654 const blink::WebLayer* pageScaleLayer, | 654 const blink::WebLayer* pageScaleLayer, |
655 const blink::WebLayer* innerViewportScrollLayer, | 655 const blink::WebLayer* innerViewportScrollLayer, |
656 const blink::WebLayer* outerViewportScrollLayer) { | 656 const blink::WebLayer* outerViewportScrollLayer) { |
657 layer_tree_host_->RegisterViewportLayers( | 657 layer_tree_host_->RegisterViewportLayers( |
658 static_cast<const WebLayerImpl*>(pageScaleLayer)->layer(), | 658 static_cast<const cc_blink::WebLayerImpl*>(pageScaleLayer)->layer(), |
659 static_cast<const WebLayerImpl*>(innerViewportScrollLayer)->layer(), | 659 static_cast<const cc_blink::WebLayerImpl*>(innerViewportScrollLayer) |
| 660 ->layer(), |
660 // The outer viewport layer will only exist when using pinch virtual | 661 // The outer viewport layer will only exist when using pinch virtual |
661 // viewports. | 662 // viewports. |
662 outerViewportScrollLayer | 663 outerViewportScrollLayer ? static_cast<const cc_blink::WebLayerImpl*>( |
663 ? static_cast<const WebLayerImpl*>(outerViewportScrollLayer)->layer() | 664 outerViewportScrollLayer)->layer() |
664 : NULL); | 665 : NULL); |
665 } | 666 } |
666 | 667 |
667 void RenderWidgetCompositor::clearViewportLayers() { | 668 void RenderWidgetCompositor::clearViewportLayers() { |
668 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), | 669 layer_tree_host_->RegisterViewportLayers(scoped_refptr<cc::Layer>(), |
669 scoped_refptr<cc::Layer>(), | 670 scoped_refptr<cc::Layer>(), |
670 scoped_refptr<cc::Layer>()); | 671 scoped_refptr<cc::Layer>()); |
671 } | 672 } |
672 | 673 |
673 void RenderWidgetCompositor::registerSelection( | 674 void RenderWidgetCompositor::registerSelection( |
674 const blink::WebSelectionBound& start, | 675 const blink::WebSelectionBound& start, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 widget_->OnSwapBuffersAborted(); | 817 widget_->OnSwapBuffersAborted(); |
817 } | 818 } |
818 | 819 |
819 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 820 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
820 cc::ContextProvider* provider = | 821 cc::ContextProvider* provider = |
821 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 822 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
822 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 823 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
823 } | 824 } |
824 | 825 |
825 } // namespace content | 826 } // namespace content |
OLD | NEW |