OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/display_compositor/gpu_compositor_frame_sink_base.h" |
| 6 |
| 7 #include "cc/surfaces/surface_reference.h" |
| 8 |
| 9 namespace display_compositor { |
| 10 |
| 11 GpuCompositorFrameSinkBase::GpuCompositorFrameSinkBase( |
| 12 GpuCompositorFrameSinkDelegate* delegate, |
| 13 std::unique_ptr<cc::CompositorFrameSinkSupport> support, |
| 14 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 15 compositor_frame_sink_private_request, |
| 16 cc::mojom::MojoCompositorFrameSinkClientPtr client) |
| 17 : GpuCompositorFrameSink(delegate, std::move(support), std::move(client)), |
| 18 compositor_frame_sink_private_binding_( |
| 19 this, |
| 20 std::move(compositor_frame_sink_private_request)) { |
| 21 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 22 base::Bind(&GpuCompositorFrameSinkBase::OnPrivateConnectionLost, |
| 23 base::Unretained(this))); |
| 24 SetPrivateConnectionLost(false); |
| 25 } |
| 26 |
| 27 GpuCompositorFrameSinkBase::~GpuCompositorFrameSinkBase() {} |
| 28 |
| 29 void GpuCompositorFrameSinkBase::AddChildFrameSink( |
| 30 const cc::FrameSinkId& child_frame_sink_id) { |
| 31 support_->AddChildFrameSink(child_frame_sink_id); |
| 32 } |
| 33 |
| 34 void GpuCompositorFrameSinkBase::RemoveChildFrameSink( |
| 35 const cc::FrameSinkId& child_frame_sink_id) { |
| 36 support_->RemoveChildFrameSink(child_frame_sink_id); |
| 37 } |
| 38 |
| 39 void GpuCompositorFrameSinkBase::OnPrivateConnectionLost() { |
| 40 SetPrivateConnectionLost(true); |
| 41 // Request destruction of |this| only if both connections are lost. |
| 42 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), |
| 43 GetClientConnectionLost()); |
| 44 } |
| 45 |
| 46 } // namespace display_compositor |
OLD | NEW |