| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/exo/compositor_frame_sink.h" | 5 #include "components/exo/compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
| 10 #include "components/exo/compositor_frame_sink_holder.h" | 10 #include "components/exo/compositor_frame_sink_holder.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 | 12 |
| 13 namespace exo { | 13 namespace exo { |
| 14 | 14 |
| 15 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 16 // ExoComopositorFrameSink, public: | 16 // ExoComopositorFrameSink, public: |
| 17 | 17 |
| 18 CompositorFrameSink::CompositorFrameSink(const cc::FrameSinkId& frame_sink_id, | 18 CompositorFrameSink::CompositorFrameSink(const cc::FrameSinkId& frame_sink_id, |
| 19 cc::SurfaceManager* surface_manager, | 19 cc::SurfaceManager* surface_manager, |
| 20 CompositorFrameSinkHolder* client) | 20 CompositorFrameSinkHolder* client) |
| 21 : support_(this, | 21 : support_(cc::CompositorFrameSinkSupport::Create( |
| 22 surface_manager, | 22 this, |
| 23 frame_sink_id, | 23 surface_manager, |
| 24 false /* is_root */, | 24 frame_sink_id, |
| 25 true /* handles_frame_sink_id_invalidation */, | 25 false /* is_root */, |
| 26 true /* needs_sync_points */), | 26 true /* handles_frame_sink_id_invalidation */, |
| 27 true /* needs_sync_points */)), |
| 27 client_(client) {} | 28 client_(client) {} |
| 28 | 29 |
| 29 CompositorFrameSink::~CompositorFrameSink() {} | 30 CompositorFrameSink::~CompositorFrameSink() {} |
| 30 | 31 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 32 // cc::mojom::MojoCompositorFrameSink overrides: | 33 // cc::mojom::MojoCompositorFrameSink overrides: |
| 33 | 34 |
| 34 void CompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { | 35 void CompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 35 support_.SetNeedsBeginFrame(needs_begin_frame); | 36 support_->SetNeedsBeginFrame(needs_begin_frame); |
| 36 } | 37 } |
| 37 | 38 |
| 38 void CompositorFrameSink::SubmitCompositorFrame( | 39 void CompositorFrameSink::SubmitCompositorFrame( |
| 39 const cc::LocalSurfaceId& local_surface_id, | 40 const cc::LocalSurfaceId& local_surface_id, |
| 40 cc::CompositorFrame frame) { | 41 cc::CompositorFrame frame) { |
| 41 support_.SubmitCompositorFrame(local_surface_id, std::move(frame)); | 42 support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void CompositorFrameSink::BeginFrameDidNotSwap( | 45 void CompositorFrameSink::BeginFrameDidNotSwap( |
| 45 const cc::BeginFrameAck& begin_frame_ack) { | 46 const cc::BeginFrameAck& begin_frame_ack) { |
| 46 support_.BeginFrameDidNotSwap(begin_frame_ack); | 47 support_->BeginFrameDidNotSwap(begin_frame_ack); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void CompositorFrameSink::EvictFrame() { | 50 void CompositorFrameSink::EvictFrame() { |
| 50 support_.EvictFrame(); | 51 support_->EvictFrame(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
| 54 // cc::CompositorFrameSinkSupportClient overrides: | 55 // cc::CompositorFrameSinkSupportClient overrides: |
| 55 | 56 |
| 56 void CompositorFrameSink::DidReceiveCompositorFrameAck() { | 57 void CompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 57 client_->DidReceiveCompositorFrameAck(); | 58 client_->DidReceiveCompositorFrameAck(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { | 61 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 61 client_->OnBeginFrame(args); | 62 client_->OnBeginFrame(args); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void CompositorFrameSink::ReclaimResources( | 65 void CompositorFrameSink::ReclaimResources( |
| 65 const cc::ReturnedResourceArray& resources) { | 66 const cc::ReturnedResourceArray& resources) { |
| 66 client_->ReclaimResources(resources); | 67 client_->ReclaimResources(resources); |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace exo | 70 } // namespace exo |
| OLD | NEW |