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 "cc/surfaces/surface_reference.h" | 7 #include "cc/surfaces/surface_reference.h" |
8 #include "services/ui/surfaces/display_compositor.h" | 8 #include "services/ui/surfaces/display_compositor.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 GpuCompositorFrameSink::GpuCompositorFrameSink( | 12 GpuCompositorFrameSink::GpuCompositorFrameSink( |
13 DisplayCompositor* display_compositor, | 13 DisplayCompositor* display_compositor, |
14 const cc::FrameSinkId& frame_sink_id, | 14 const cc::FrameSinkId& frame_sink_id, |
15 std::unique_ptr<cc::Display> display, | 15 std::unique_ptr<cc::Display> display, |
16 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | 16 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, |
17 cc::mojom::MojoCompositorFrameSinkRequest request, | 17 cc::mojom::MojoCompositorFrameSinkRequest request, |
18 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 18 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
19 compositor_frame_sink_private_request, | 19 compositor_frame_sink_private_request, |
20 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 20 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
21 cc::mojom::DisplayPrivateRequest display_private_request) | 21 cc::mojom::DisplayPrivateRequest display_private_request) |
22 : display_compositor_(display_compositor), | 22 : display_compositor_(display_compositor), |
| 23 display_(std::move(display)), |
| 24 display_begin_frame_source_(std::move(begin_frame_source)), |
23 support_(this, | 25 support_(this, |
24 display_compositor->manager(), | 26 display_compositor->manager(), |
25 frame_sink_id, | 27 frame_sink_id, |
26 std::move(display), | 28 display_.get(), |
27 std::move(begin_frame_source)), | 29 false), |
28 surface_tracker_(frame_sink_id), | 30 surface_tracker_(frame_sink_id), |
29 client_(std::move(client)), | 31 client_(std::move(client)), |
30 binding_(this, std::move(request)), | 32 binding_(this, std::move(request)), |
31 compositor_frame_sink_private_binding_( | 33 compositor_frame_sink_private_binding_( |
32 this, | 34 this, |
33 std::move(compositor_frame_sink_private_request)), | 35 std::move(compositor_frame_sink_private_request)), |
34 display_private_binding_(this, std::move(display_private_request)) { | 36 display_private_binding_(this, std::move(display_private_request)) { |
| 37 if (display_.get()) |
| 38 display_->SetVisible(true); |
35 binding_.set_connection_error_handler(base::Bind( | 39 binding_.set_connection_error_handler(base::Bind( |
36 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); | 40 &GpuCompositorFrameSink::OnClientConnectionLost, base::Unretained(this))); |
37 | 41 |
38 compositor_frame_sink_private_binding_.set_connection_error_handler( | 42 compositor_frame_sink_private_binding_.set_connection_error_handler( |
39 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 43 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
40 base::Unretained(this))); | 44 base::Unretained(this))); |
41 } | 45 } |
42 | 46 |
43 GpuCompositorFrameSink::~GpuCompositorFrameSink() { | 47 GpuCompositorFrameSink::~GpuCompositorFrameSink() { |
44 // For display root surfaces, remove the reference from top level root to | 48 // For display root surfaces, remove the reference from top level root to |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 173 } |
170 | 174 |
171 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 175 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
172 private_connection_lost_ = true; | 176 private_connection_lost_ = true; |
173 // Request destruction of |this| only if both connections are lost. | 177 // Request destruction of |this| only if both connections are lost. |
174 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( | 178 display_compositor_->OnCompositorFrameSinkPrivateConnectionLost( |
175 support_.frame_sink_id(), client_connection_lost_); | 179 support_.frame_sink_id(), client_connection_lost_); |
176 } | 180 } |
177 | 181 |
178 } // namespace ui | 182 } // namespace ui |
OLD | NEW |