| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 23 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 24 #include "base/trace_event/trace_event_synthetic_delay.h" | 24 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "cc/output/compositor_frame_sink.h" |
| 26 #include "cc/output/copy_output_request.h" | 27 #include "cc/output/copy_output_request.h" |
| 27 #include "cc/output/output_surface.h" | |
| 28 #include "cc/scheduler/begin_frame_source.h" | 28 #include "cc/scheduler/begin_frame_source.h" |
| 29 #include "content/common/content_switches_internal.h" | 29 #include "content/common/content_switches_internal.h" |
| 30 #include "content/common/input/synthetic_gesture_packet.h" | 30 #include "content/common/input/synthetic_gesture_packet.h" |
| 31 #include "content/common/input_messages.h" | 31 #include "content/common/input_messages.h" |
| 32 #include "content/common/swapped_out_messages.h" | 32 #include "content/common/swapped_out_messages.h" |
| 33 #include "content/common/text_input_state.h" | 33 #include "content/common/text_input_state.h" |
| 34 #include "content/common/view_messages.h" | 34 #include "content/common/view_messages.h" |
| 35 #include "content/public/common/content_features.h" | 35 #include "content/public/common/content_features.h" |
| 36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
| 37 #include "content/public/common/context_menu_params.h" | 37 #include "content/public/common/context_menu_params.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 738 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 739 // render_thread may be NULL in tests. | 739 // render_thread may be NULL in tests. |
| 740 InputHandlerManager* input_handler_manager = | 740 InputHandlerManager* input_handler_manager = |
| 741 render_thread ? render_thread->input_handler_manager() : NULL; | 741 render_thread ? render_thread->input_handler_manager() : NULL; |
| 742 if (input_handler_manager) | 742 if (input_handler_manager) |
| 743 input_handler_manager->ProcessRafAlignedInputOnMainThread(routing_id_); | 743 input_handler_manager->ProcessRafAlignedInputOnMainThread(routing_id_); |
| 744 | 744 |
| 745 GetWebWidget()->beginFrame(frame_time_sec); | 745 GetWebWidget()->beginFrame(frame_time_sec); |
| 746 } | 746 } |
| 747 | 747 |
| 748 std::unique_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface( | 748 std::unique_ptr<cc::CompositorFrameSink> |
| 749 bool fallback) { | 749 RenderWidget::CreateCompositorFrameSink(bool fallback) { |
| 750 DCHECK(GetWebWidget()); | 750 DCHECK(GetWebWidget()); |
| 751 // For widgets that are never visible, we don't start the compositor, so we | 751 // For widgets that are never visible, we don't start the compositor, so we |
| 752 // never get a request for a cc::OutputSurface. | 752 // never get a request for a cc::CompositorFrameSink. |
| 753 DCHECK(!compositor_never_visible_); | 753 DCHECK(!compositor_never_visible_); |
| 754 return RenderThreadImpl::current()->CreateCompositorOutputSurface( | 754 return RenderThreadImpl::current()->CreateCompositorFrameSink( |
| 755 fallback, routing_id_, frame_swap_message_queue_, | 755 fallback, routing_id_, frame_swap_message_queue_, |
| 756 GetURLForGraphicsContext3D()); | 756 GetURLForGraphicsContext3D()); |
| 757 } | 757 } |
| 758 | 758 |
| 759 void RenderWidget::DidCommitAndDrawCompositorFrame() { | 759 void RenderWidget::DidCommitAndDrawCompositorFrame() { |
| 760 // NOTE: Tests may break if this event is renamed or moved. See | 760 // NOTE: Tests may break if this event is renamed or moved. See |
| 761 // tab_capture_performancetest.cc. | 761 // tab_capture_performancetest.cc. |
| 762 TRACE_EVENT0("gpu", "RenderWidget::DidCommitAndDrawCompositorFrame"); | 762 TRACE_EVENT0("gpu", "RenderWidget::DidCommitAndDrawCompositorFrame"); |
| 763 | 763 |
| 764 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, | 764 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void RenderWidget::initializeLayerTreeView() { | 1133 void RenderWidget::initializeLayerTreeView() { |
| 1134 DCHECK(!host_closing_); | 1134 DCHECK(!host_closing_); |
| 1135 | 1135 |
| 1136 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_, | 1136 compositor_ = RenderWidgetCompositor::Create(this, device_scale_factor_, |
| 1137 compositor_deps_); | 1137 compositor_deps_); |
| 1138 compositor_->setViewportSize(physical_backing_size_); | 1138 compositor_->setViewportSize(physical_backing_size_); |
| 1139 OnDeviceScaleFactorChanged(); | 1139 OnDeviceScaleFactorChanged(); |
| 1140 // For background pages and certain tests, we don't want to trigger | 1140 // For background pages and certain tests, we don't want to trigger |
| 1141 // OutputSurface creation. | 1141 // CompositorFrameSink creation. |
| 1142 if (compositor_never_visible_ || !RenderThreadImpl::current()) | 1142 if (compositor_never_visible_ || !RenderThreadImpl::current()) |
| 1143 compositor_->SetNeverVisible(); | 1143 compositor_->SetNeverVisible(); |
| 1144 | 1144 |
| 1145 StartCompositor(); | 1145 StartCompositor(); |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 void RenderWidget::WillCloseLayerTreeView() { | 1148 void RenderWidget::WillCloseLayerTreeView() { |
| 1149 if (host_closing_) | 1149 if (host_closing_) |
| 1150 return; | 1150 return; |
| 1151 | 1151 |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 bool RenderWidget::isPointerLocked() { | 2132 bool RenderWidget::isPointerLocked() { |
| 2133 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2133 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2134 webwidget_mouse_lock_target_.get()); | 2134 webwidget_mouse_lock_target_.get()); |
| 2135 } | 2135 } |
| 2136 | 2136 |
| 2137 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2137 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2138 return webwidget_internal_; | 2138 return webwidget_internal_; |
| 2139 } | 2139 } |
| 2140 | 2140 |
| 2141 } // namespace content | 2141 } // namespace content |
| OLD | NEW |