Chromium Code Reviews| 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)), | |
| 22 support_(this, | 23 support_(this, |
| 23 display_compositor->manager(), | 24 display_compositor->manager(), |
| 24 frame_sink_id, | 25 frame_sink_id, |
| 25 std::move(display), | 26 display_.get(), |
| 26 std::move(begin_frame_source)), | 27 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 support_.display()->SetVisible(true); | |
|
Fady Samuel
2017/01/05 00:36:38
We might not have a display(). Please add a guard:
Alex Z.
2017/01/05 00:48:26
Done.
| |
| 33 binding_.set_connection_error_handler(base::Bind( | 35 binding_.set_connection_error_handler(base::Bind( |
| 34 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); | 36 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); |
| 35 | 37 |
| 36 compositor_frame_sink_private_binding_.set_connection_error_handler( | 38 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 37 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 39 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
| 38 base::Unretained(this))); | 40 base::Unretained(this))); |
| 39 } | 41 } |
| 40 | 42 |
| 41 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} | 43 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} |
| 42 | 44 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 } | 135 } |
| 134 | 136 |
| 135 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 137 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 136 private_connection_lost_ = true; | 138 private_connection_lost_ = true; |
| 137 // Request destruction of |this| only if both connections are lost. | 139 // Request destruction of |this| only if both connections are lost. |
| 138 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( | 140 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( |
| 139 support_.frame_sink_id(), client_connection_lost_); | 141 support_.frame_sink_id(), client_connection_lost_); |
| 140 } | 142 } |
| 141 | 143 |
| 142 } // namespace ui | 144 } // namespace ui |
| OLD | NEW |