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_manager.h" | |
|
danakj
2017/02/08 21:54:40
is needed? this doesn't even take a surfacemanager
Alex Z.
2017/02/08 22:07:52
Done.
| |
| 7 #include "cc/surfaces/surface_reference.h" | 8 #include "cc/surfaces/surface_reference.h" |
| 8 | 9 |
| 9 namespace display_compositor { | 10 namespace display_compositor { |
| 10 | 11 |
| 11 GpuCompositorFrameSink::GpuCompositorFrameSink( | 12 GpuCompositorFrameSink::GpuCompositorFrameSink( |
| 12 GpuCompositorFrameSinkDelegate* delegate, | 13 GpuCompositorFrameSinkDelegate* delegate, |
| 13 cc::SurfaceManager* surface_manager, | 14 std::unique_ptr<cc::CompositorFrameSinkSupport> support, |
| 14 const cc::FrameSinkId& frame_sink_id, | |
| 15 cc::Display* display, | |
| 16 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 15 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
| 17 compositor_frame_sink_private_request, | 16 compositor_frame_sink_private_request, |
| 18 cc::mojom::MojoCompositorFrameSinkClientPtr client) | 17 cc::mojom::MojoCompositorFrameSinkClientPtr client) |
| 19 : delegate_(delegate), | 18 : delegate_(delegate), |
| 20 support_(this, | 19 support_(std::move(support)), |
| 21 surface_manager, | |
| 22 frame_sink_id, | |
| 23 display, | |
| 24 true /* handles_frame_sink_id_invalidation */, | |
| 25 true /* needs_sync_points */), | |
| 26 surface_manager_(surface_manager), | |
| 27 client_(std::move(client)), | 20 client_(std::move(client)), |
| 28 compositor_frame_sink_private_binding_( | 21 compositor_frame_sink_private_binding_( |
| 29 this, | 22 this, |
| 30 std::move(compositor_frame_sink_private_request)) { | 23 std::move(compositor_frame_sink_private_request)) { |
| 31 compositor_frame_sink_private_binding_.set_connection_error_handler( | 24 compositor_frame_sink_private_binding_.set_connection_error_handler( |
| 32 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, | 25 base::Bind(&GpuCompositorFrameSink::OnPrivateConnectionLost, |
| 33 base::Unretained(this))); | 26 base::Unretained(this))); |
| 34 } | 27 } |
| 35 | 28 |
| 36 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} | 29 GpuCompositorFrameSink::~GpuCompositorFrameSink() {} |
| 37 | 30 |
| 38 void GpuCompositorFrameSink::EvictFrame() { | 31 void GpuCompositorFrameSink::EvictFrame() { |
| 39 support_.EvictFrame(); | 32 support_->EvictFrame(); |
| 40 } | 33 } |
| 41 | 34 |
| 42 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { | 35 void GpuCompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 43 support_.SetNeedsBeginFrame(needs_begin_frame); | 36 support_->SetNeedsBeginFrame(needs_begin_frame); |
| 44 } | 37 } |
| 45 | 38 |
| 46 void GpuCompositorFrameSink::SubmitCompositorFrame( | 39 void GpuCompositorFrameSink::SubmitCompositorFrame( |
| 47 const cc::LocalSurfaceId& local_surface_id, | 40 const cc::LocalSurfaceId& local_surface_id, |
| 48 cc::CompositorFrame frame) { | 41 cc::CompositorFrame frame) { |
| 49 support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); | 42 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| 50 } | 43 } |
| 51 | 44 |
| 52 void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id, | 45 void GpuCompositorFrameSink::Require(const cc::LocalSurfaceId& local_surface_id, |
| 53 const cc::SurfaceSequence& sequence) { | 46 const cc::SurfaceSequence& sequence) { |
| 54 support_.Require(local_surface_id, sequence); | 47 support_->Require(local_surface_id, sequence); |
| 55 } | 48 } |
| 56 | 49 |
| 57 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { | 50 void GpuCompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { |
| 58 support_.Satisfy(sequence); | 51 support_->Satisfy(sequence); |
| 59 } | 52 } |
| 60 | 53 |
| 61 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { | 54 void GpuCompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 62 if (client_) | 55 if (client_) |
| 63 client_->DidReceiveCompositorFrameAck(); | 56 client_->DidReceiveCompositorFrameAck(); |
| 64 } | 57 } |
| 65 | 58 |
| 66 void GpuCompositorFrameSink::AddChildFrameSink( | 59 void GpuCompositorFrameSink::AddChildFrameSink( |
| 67 const cc::FrameSinkId& child_frame_sink_id) { | 60 const cc::FrameSinkId& child_frame_sink_id) { |
| 68 support_.AddChildFrameSink(child_frame_sink_id); | 61 support_->AddChildFrameSink(child_frame_sink_id); |
| 69 } | 62 } |
| 70 | 63 |
| 71 void GpuCompositorFrameSink::RemoveChildFrameSink( | 64 void GpuCompositorFrameSink::RemoveChildFrameSink( |
| 72 const cc::FrameSinkId& child_frame_sink_id) { | 65 const cc::FrameSinkId& child_frame_sink_id) { |
| 73 support_.RemoveChildFrameSink(child_frame_sink_id); | 66 support_->RemoveChildFrameSink(child_frame_sink_id); |
| 74 } | 67 } |
| 75 | 68 |
| 76 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { | 69 void GpuCompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 77 if (client_) | 70 if (client_) |
| 78 client_->OnBeginFrame(args); | 71 client_->OnBeginFrame(args); |
| 79 } | 72 } |
| 80 | 73 |
| 81 void GpuCompositorFrameSink::ReclaimResources( | 74 void GpuCompositorFrameSink::ReclaimResources( |
| 82 const cc::ReturnedResourceArray& resources) { | 75 const cc::ReturnedResourceArray& resources) { |
| 83 if (client_) | 76 if (client_) |
| 84 client_->ReclaimResources(resources); | 77 client_->ReclaimResources(resources); |
| 85 } | 78 } |
| 86 | 79 |
| 87 void GpuCompositorFrameSink::WillDrawSurface() { | 80 void GpuCompositorFrameSink::WillDrawSurface() { |
| 88 if (client_) | 81 if (client_) |
| 89 client_->WillDrawSurface(); | 82 client_->WillDrawSurface(); |
| 90 } | 83 } |
| 91 | 84 |
| 92 void GpuCompositorFrameSink::OnClientConnectionLost() { | 85 void GpuCompositorFrameSink::OnClientConnectionLost() { |
| 93 client_connection_lost_ = true; | 86 client_connection_lost_ = true; |
| 94 // Request destruction of |this| only if both connections are lost. | 87 // Request destruction of |this| only if both connections are lost. |
| 95 delegate_->OnClientConnectionLost(support_.frame_sink_id(), | 88 delegate_->OnClientConnectionLost(support_->frame_sink_id(), |
| 96 private_connection_lost_); | 89 private_connection_lost_); |
| 97 } | 90 } |
| 98 | 91 |
| 99 void GpuCompositorFrameSink::OnPrivateConnectionLost() { | 92 void GpuCompositorFrameSink::OnPrivateConnectionLost() { |
| 100 private_connection_lost_ = true; | 93 private_connection_lost_ = true; |
| 101 // Request destruction of |this| only if both connections are lost. | 94 // Request destruction of |this| only if both connections are lost. |
| 102 delegate_->OnPrivateConnectionLost(support_.frame_sink_id(), | 95 delegate_->OnPrivateConnectionLost(support_->frame_sink_id(), |
| 103 client_connection_lost_); | 96 client_connection_lost_); |
| 104 } | 97 } |
| 105 | 98 |
| 106 } // namespace display_compositor | 99 } // namespace display_compositor |
| OLD | NEW |