| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck( | 443 void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck( |
| 444 const std::vector<viz::ReturnedResource>& resources) { | 444 const std::vector<viz::ReturnedResource>& resources) { |
| 445 renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources); | 445 renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void RenderWidgetHostViewChildFrame::DidCreateNewRendererCompositorFrameSink( | 448 void RenderWidgetHostViewChildFrame::DidCreateNewRendererCompositorFrameSink( |
| 449 viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) { | 449 viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink, |
| 450 viz::mojom::TargetFrameForInputDelegate* input_delegate) { |
| 450 ResetCompositorFrameSinkSupport(); | 451 ResetCompositorFrameSinkSupport(); |
| 451 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; | 452 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; |
| 452 CreateCompositorFrameSinkSupport(); | 453 CreateCompositorFrameSinkSupport(input_delegate); |
| 453 has_frame_ = false; | 454 has_frame_ = false; |
| 454 } | 455 } |
| 455 | 456 |
| 456 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( | 457 void RenderWidgetHostViewChildFrame::ProcessCompositorFrame( |
| 457 const viz::LocalSurfaceId& local_surface_id, | 458 const viz::LocalSurfaceId& local_surface_id, |
| 458 cc::CompositorFrame frame) { | 459 cc::CompositorFrame frame) { |
| 459 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); | 460 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); |
| 460 current_surface_scale_factor_ = frame.metadata.device_scale_factor; | 461 current_surface_scale_factor_ = frame.metadata.device_scale_factor; |
| 461 | 462 |
| 462 bool result = | 463 bool result = |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 } | 829 } |
| 829 | 830 |
| 830 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 831 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 831 return true; | 832 return true; |
| 832 } | 833 } |
| 833 | 834 |
| 834 viz::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 835 viz::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 835 return viz::SurfaceId(frame_sink_id_, local_surface_id_); | 836 return viz::SurfaceId(frame_sink_id_, local_surface_id_); |
| 836 } | 837 } |
| 837 | 838 |
| 838 void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() { | 839 void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport( |
| 840 viz::mojom::TargetFrameForInputDelegate* input_delegate) { |
| 839 if (service_manager::ServiceManagerIsRemote()) | 841 if (service_manager::ServiceManagerIsRemote()) |
| 840 return; | 842 return; |
| 841 | 843 |
| 842 DCHECK(!support_); | 844 DCHECK(!support_); |
| 843 constexpr bool is_root = false; | 845 constexpr bool is_root = false; |
| 844 constexpr bool handles_frame_sink_id_invalidation = false; | 846 constexpr bool handles_frame_sink_id_invalidation = false; |
| 845 constexpr bool needs_sync_points = true; | 847 constexpr bool needs_sync_points = true; |
| 846 support_ = GetHostFrameSinkManager()->CreateCompositorFrameSinkSupport( | 848 support_ = GetHostFrameSinkManager()->CreateCompositorFrameSinkSupport( |
| 847 this, frame_sink_id_, is_root, handles_frame_sink_id_invalidation, | 849 this, input_delegate, frame_sink_id_, is_root, |
| 848 needs_sync_points); | 850 handles_frame_sink_id_invalidation, needs_sync_points); |
| 849 if (parent_frame_sink_id_.is_valid()) { | 851 if (parent_frame_sink_id_.is_valid()) { |
| 850 GetHostFrameSinkManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_, | 852 GetHostFrameSinkManager()->RegisterFrameSinkHierarchy(parent_frame_sink_id_, |
| 851 frame_sink_id_); | 853 frame_sink_id_); |
| 852 } | 854 } |
| 853 if (host_->needs_begin_frames()) | 855 if (host_->needs_begin_frames()) |
| 854 support_->SetNeedsBeginFrame(true); | 856 support_->SetNeedsBeginFrame(true); |
| 855 } | 857 } |
| 856 | 858 |
| 857 void RenderWidgetHostViewChildFrame::ResetCompositorFrameSinkSupport() { | 859 void RenderWidgetHostViewChildFrame::ResetCompositorFrameSinkSupport() { |
| 858 if (!support_) | 860 if (!support_) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 auto origin = GetViewBounds().origin() - | 900 auto origin = GetViewBounds().origin() - |
| 899 frame_connector_->GetRootRenderWidgetHostView() | 901 frame_connector_->GetRootRenderWidgetHostView() |
| 900 ->GetViewBounds() | 902 ->GetViewBounds() |
| 901 .origin(); | 903 .origin(); |
| 902 return gfx::Point(origin.x(), origin.y()); | 904 return gfx::Point(origin.x(), origin.y()); |
| 903 } | 905 } |
| 904 return gfx::Point(); | 906 return gfx::Point(); |
| 905 } | 907 } |
| 906 | 908 |
| 907 } // namespace content | 909 } // namespace content |
| OLD | NEW |