| 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 "services/ui/surfaces/gpu_compositor_frame_sink.h" | 5 #include "services/ui/surfaces/gpu_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "services/ui/surfaces/display_compositor.h" | 7 #include "services/ui/surfaces/display_compositor.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| 11 GpuCompositorFrameSink::GpuCompositorFrameSink( | 11 GpuCompositorFrameSink::GpuCompositorFrameSink( |
| 12 DisplayCompositor* display_compositor, | 12 DisplayCompositor* display_compositor, |
| 13 const cc::FrameSinkId& frame_sink_id, | 13 const cc::FrameSinkId& frame_sink_id, |
| 14 std::unique_ptr<cc::Display> display, | 14 std::unique_ptr<cc::Display> display, |
| 15 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | 15 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, |
| 16 cc::mojom::MojoCompositorFrameSinkRequest request, | 16 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 17 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 17 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 18 compositor_frame_sink_private_request, | 18 compositor_frame_sink_private_request, |
| 19 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 19 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 20 cc::mojom::DisplayPrivateRequest display_private_request) | 20 cc::mojom::DisplayPrivateRequest display_private_request) |
| 21 : display_compositor_(display_compositor), | 21 : display_compositor_(display_compositor), |
| 22 display_(std::move(display)), |
| 23 display_begin_frame_source_(std::move(begin_frame_source)), |
| 22 support_(this, | 24 support_(this, |
| 23 display_compositor->manager(), | 25 display_compositor->manager(), |
| 24 frame_sink_id, | 26 frame_sink_id, |
| 25 std::move(display), | 27 display_.get()), |
| 26 std::move(begin_frame_source)), | |
| 27 client_(std::move(client)), | 28 client_(std::move(client)), |
| 28 binding_(this, std::move(request)), | 29 binding_(this, std::move(request)), |
| 29 compositor_frame_sink_private_binding_( | 30 compositor_frame_sink_private_binding_( |
| 30 this, | 31 this, |
| 31 std::move(compositor_frame_sink_private_request)), | 32 std::move(compositor_frame_sink_private_request)), |
| 32 display_private_binding_(this, std::move(display_private_request)) { | 33 display_private_binding_(this, std::move(display_private_request)) { |
| 34 if (display_.get()) |
| 35 display_->SetVisible(true); |
| 33 binding_.set_connection_error_handler(base::Bind( | 36 binding_.set_connection_error_handler(base::Bind( |
| 34 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); | 37 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); |
| 35 | 38 |
| 36 compositor_frame_sink_private_binding_.set_connection_error_handler( | 39 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 37 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 40 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
| 38 base::Unretained(this))); | 41 base::Unretained(this))); |
| 39 } | 42 } |
| 40 | 43 |
| 41 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} | 44 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} |
| 42 | 45 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 136 } |
| 134 | 137 |
| 135 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 138 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 136 private_connection_lost_ = true; | 139 private_connection_lost_ = true; |
| 137 // Request destruction of |this| only if both connections are lost. | 140 // Request destruction of |this| only if both connections are lost. |
| 138 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( | 141 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( |
| 139 support_.frame_sink_id(), client_connection_lost_); | 142 support_.frame_sink_id(), client_connection_lost_); |
| 140 } | 143 } |
| 141 | 144 |
| 142 } // namespace ui | 145 } // namespace ui |
| OLD | NEW |