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 "components/display_compositor/gpu_compositor_frame_sink.h" | 5 #include "components/display_compositor/gpu_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface_reference.h" | 7 #include "cc/surfaces/surface_reference.h" |
| 8 | 8 |
| 9 namespace display_compositor { | 9 namespace display_compositor { |
| 10 | 10 |
| 11 GpuCompositorFrameSink::GpuCompositorFrameSink( | 11 GpuCompositorFrameSink::GpuCompositorFrameSink( |
| 12 GpuCompositorFrameSinkDelegate* delegate, | 12 GpuCompositorFrameSinkDelegate* delegate, |
| 13 cc::SurfaceManager* surface_manager, | 13 cc::SurfaceManager* surface_manager, |
| 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::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 : delegate_(delegate), | 20 : delegate_(delegate), |
| 21 support_(this, | 21 support_(this, surface_manager, frame_sink_id, display.get()), |
| 22 surface_manager, | |
| 23 frame_sink_id, | |
| 24 std::move(display), | |
| 25 std::move(begin_frame_source)), | |
| 26 surface_manager_(surface_manager), | 22 surface_manager_(surface_manager), |
| 23 display_(std::move(display)), | |
|
Fady Samuel
2017/01/29 15:43:01
Move to GpuDisplayCompositorFrameSInk
Alex Z.
2017/01/30 20:37:49
Done.
| |
| 24 display_begin_frame_source_(std::move(begin_frame_source)), | |
|
Fady Samuel
2017/01/29 15:43:01
Move to GpuDisplayCompositorFrameSInk
Alex Z.
2017/01/30 20:37:49
Done.
| |
| 25 | |
| 27 surface_tracker_(frame_sink_id), | 26 surface_tracker_(frame_sink_id), |
| 28 client_(std::move(client)), | 27 client_(std::move(client)), |
| 29 compositor_frame_sink_private_binding_( | 28 compositor_frame_sink_private_binding_( |
| 30 this, | 29 this, |
| 31 std::move(compositor_frame_sink_private_request)) { | 30 std::move(compositor_frame_sink_private_request)) { |
| 32 compositor_frame_sink_private_binding_.set_connection_error_handler( | 31 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 33 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 32 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
| 34 base::Unretained(this))); | 33 base::Unretained(this))); |
| 34 | |
| 35 if (display_.get()) | |
| 36 display_->SetVisible(true); | |
|
Fady Samuel
2017/01/29 15:43:01
Move to GpuDisplayCompositorFrameSink. No need to
Alex Z.
2017/01/30 20:37:49
Done.
| |
| 35 } | 37 } |
| 36 | 38 |
| 37 GpuCompositorFrameSink::~GpuCompositorFrameSink() { | 39 GpuCompositorFrameSink::~GpuCompositorFrameSink() { |
| 38 // For display root surfaces, remove the reference from top level root to | 40 // For display root surfaces, remove the reference from top level root to |
| 39 // indicate the display root surface is no longer visible. | 41 // indicate the display root surface is no longer visible. |
| 40 if (support_.display() && surface_tracker_.current_surface_id().is_valid()) { | 42 if (support_.display() && surface_tracker_.current_surface_id().is_valid()) { |
| 41 const cc::SurfaceId top_level_root_surface_id = | 43 const cc::SurfaceId top_level_root_surface_id = |
| 42 surface_manager_->GetRootSurfaceId(); | 44 surface_manager_->GetRootSurfaceId(); |
| 43 std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference( | 45 std::vector<cc::SurfaceReference> references_to_remove{cc::SurfaceReference( |
| 44 top_level_root_surface_id, surface_tracker_.current_surface_id())}; | 46 top_level_root_surface_id, surface_tracker_.current_surface_id())}; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 } | 146 } |
| 145 | 147 |
| 146 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 148 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 147 private_connection_lost_ = true; | 149 private_connection_lost_ = true; |
| 148 // Request destruction of |this| only if both connections are lost. | 150 // Request destruction of |this| only if both connections are lost. |
| 149 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), | 151 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), |
| 150 client_connection_lost_); | 152 client_connection_lost_); |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace display_compositor | 155 } // namespace display_compositor |
| OLD | NEW |