| Index: components/display_compositor/gpu_compositor_frame_sink_base.cc
|
| diff --git a/components/display_compositor/gpu_compositor_frame_sink_base.cc b/components/display_compositor/gpu_compositor_frame_sink_base.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ea04fc53c00604a78b34090148f92b6aec718233
|
| --- /dev/null
|
| +++ b/components/display_compositor/gpu_compositor_frame_sink_base.cc
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/display_compositor/gpu_compositor_frame_sink_base.h"
|
| +
|
| +#include "cc/surfaces/surface_reference.h"
|
| +
|
| +namespace display_compositor {
|
| +
|
| +GpuCompositorFrameSinkBase::GpuCompositorFrameSinkBase(
|
| + GpuCompositorFrameSinkDelegate* delegate,
|
| + std::unique_ptr<cc::CompositorFrameSinkSupport> support,
|
| + cc::mojom::MojoCompositorFrameSinkPrivateRequest
|
| + compositor_frame_sink_private_request,
|
| + cc::mojom::MojoCompositorFrameSinkClientPtr client)
|
| + : GpuCompositorFrameSink(delegate, std::move(support), std::move(client)),
|
| + compositor_frame_sink_private_binding_(
|
| + this,
|
| + std::move(compositor_frame_sink_private_request)) {
|
| + compositor_frame_sink_private_binding_.set_connection_error_handler(
|
| + base::Bind(&GpuCompositorFrameSinkBase::OnPrivateConnectionLost,
|
| + base::Unretained(this)));
|
| + SetPrivateConnectionLost(false);
|
| +}
|
| +
|
| +GpuCompositorFrameSinkBase::~GpuCompositorFrameSinkBase() {}
|
| +
|
| +void GpuCompositorFrameSinkBase::AddChildFrameSink(
|
| + const cc::FrameSinkId& child_frame_sink_id) {
|
| + support_->AddChildFrameSink(child_frame_sink_id);
|
| +}
|
| +
|
| +void GpuCompositorFrameSinkBase::RemoveChildFrameSink(
|
| + const cc::FrameSinkId& child_frame_sink_id) {
|
| + support_->RemoveChildFrameSink(child_frame_sink_id);
|
| +}
|
| +
|
| +void GpuCompositorFrameSinkBase::OnPrivateConnectionLost() {
|
| + SetPrivateConnectionLost(true);
|
| + // Request destruction of |this| only if both connections are lost.
|
| + delegate_->OnPrivateConnectionLost(support_->frame_sink_id(),
|
| + GetClientConnectionLost());
|
| +}
|
| +
|
| +} // namespace display_compositor
|
|
|