| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/viz/frame_sinks/gpu_compositor_frame_sink.h" | 5 #include "components/viz/frame_sinks/gpu_compositor_frame_sink.h" |
| 6 | 6 |
| 7 namespace viz { | 7 namespace viz { |
| 8 | 8 |
| 9 GpuCompositorFrameSink::GpuCompositorFrameSink( | 9 GpuCompositorFrameSink::GpuCompositorFrameSink( |
| 10 GpuCompositorFrameSinkDelegate* delegate, | 10 GpuCompositorFrameSinkDelegate* delegate, |
| 11 cc::SurfaceManager* surface_manager, | 11 cc::SurfaceManager* surface_manager, |
| 12 const cc::FrameSinkId& frame_sink_id, | 12 const cc::FrameSinkId& frame_sink_id, |
| 13 cc::mojom::MojoCompositorFrameSinkRequest request, | 13 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 14 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 14 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 15 compositor_frame_sink_private_request, | 15 compositor_frame_sink_private_request, |
| 16 cc::mojom::MojoCompositorFrameSinkClientPtr client) | 16 cc::mojom::MojoCompositorFrameSinkClientPtr client) |
| 17 : delegate_(delegate), | 17 : delegate_(delegate), |
| 18 support_(base::MakeUnique<cc::CompositorFrameSinkSupport>( | 18 support_(base::MakeUnique<cc::CompositorFrameSinkSupport>( |
| 19 this, | 19 this, |
| 20 surface_manager, | |
| 21 frame_sink_id, | 20 frame_sink_id, |
| 22 false /* is_root */, | 21 false /* is_root */, |
| 23 true /* handles_frame_sink_id_invalidation */, | 22 true /* handles_frame_sink_id_invalidation */)), |
| 24 true /* needs_sync_points */)), | |
| 25 client_(std::move(client)), | 23 client_(std::move(client)), |
| 26 compositor_frame_sink_binding_(this, std::move(request)), | 24 compositor_frame_sink_binding_(this, std::move(request)), |
| 27 compositor_frame_sink_private_binding_( | 25 compositor_frame_sink_private_binding_( |
| 28 this, | 26 this, |
| 29 std::move(compositor_frame_sink_private_request)) { | 27 std::move(compositor_frame_sink_private_request)) { |
| 28 constexpr bool needs_sync_points = true; |
| 29 support_->Init(surface_manager, needs_sync_points); |
| 30 compositor_frame_sink_binding_.set_connection_error_handler(base::Bind( | 30 compositor_frame_sink_binding_.set_connection_error_handler(base::Bind( |
| 31 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); | 31 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); |
| 32 compositor_frame_sink_private_binding_.set_connection_error_handler( | 32 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 33 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 33 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
| 34 base::Unretained(this))); | 34 base::Unretained(this))); |
| 35 } | 35 } |
| 36 | 36 |
| 37 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} | 37 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} |
| 38 | 38 |
| 39 void GpuCompositorFrameSink::EvictFrame() { | 39 void GpuCompositorFrameSink::EvictFrame() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 95 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 96 private_connection_lost_ = true; | 96 private_connection_lost_ = true; |
| 97 // Request destruction of |this| only if both connections are lost. | 97 // Request destruction of |this| only if both connections are lost. |
| 98 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), | 98 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), |
| 99 client_connection_lost_); | 99 client_connection_lost_); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace viz | 102 } // namespace viz |
| OLD | NEW |