Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1104)

Unified Diff: components/display_compositor/gpu_compositor_frame_sink_base.cc

Issue 2703503002: WIP: move OffscreenCanvas into new display compositor
Patch Set: Refine connection lost Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698