OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/exo/compositor_frame_sink.h" |
| 6 |
| 7 #include "cc/surfaces/surface.h" |
| 8 #include "cc/surfaces/surface_manager.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 |
| 11 namespace exo { |
| 12 |
| 13 //////////////////////////////////////////////////////////////////////////////// |
| 14 // ExoComopositorFrameSink, public: |
| 15 |
| 16 // static |
| 17 void CompositorFrameSink::Create( |
| 18 const cc::FrameSinkId& frame_sink_id, |
| 19 cc::SurfaceManager* surface_manager, |
| 20 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 21 cc::mojom::MojoCompositorFrameSinkRequest request) { |
| 22 std::unique_ptr<CompositorFrameSink> impl = |
| 23 base::MakeUnique<CompositorFrameSink>(frame_sink_id, surface_manager, |
| 24 std::move(client)); |
| 25 CompositorFrameSink* compositor_frame_sink = impl.get(); |
| 26 compositor_frame_sink->binding_ = |
| 27 mojo::MakeStrongBinding(std::move(impl), std::move(request)); |
| 28 } |
| 29 |
| 30 CompositorFrameSink::CompositorFrameSink( |
| 31 const cc::FrameSinkId& frame_sink_id, |
| 32 cc::SurfaceManager* surface_manager, |
| 33 cc::mojom::MojoCompositorFrameSinkClientPtr client) |
| 34 : support_(this, surface_manager, frame_sink_id, nullptr), |
| 35 client_(std::move(client)) {} |
| 36 |
| 37 CompositorFrameSink::~CompositorFrameSink() {} |
| 38 |
| 39 //////////////////////////////////////////////////////////////////////////////// |
| 40 // cc::mojom::MojoCompositorFrameSink overrides: |
| 41 |
| 42 void CompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 43 support_.SetNeedsBeginFrame(needs_begin_frame); |
| 44 } |
| 45 |
| 46 void CompositorFrameSink::SubmitCompositorFrame( |
| 47 const cc::LocalFrameId& local_frame_id, |
| 48 cc::CompositorFrame frame) { |
| 49 support_.SubmitCompositorFrame(local_frame_id, std::move(frame)); |
| 50 } |
| 51 |
| 52 void CompositorFrameSink::AddSurfaceReferences( |
| 53 const std::vector<cc::SurfaceReference>& references) { |
| 54 // TODO(fsamuel, staraz): Implement this. |
| 55 NOTIMPLEMENTED(); |
| 56 } |
| 57 |
| 58 void CompositorFrameSink::RemoveSurfaceReferences( |
| 59 const std::vector<cc::SurfaceReference>& references) { |
| 60 // TODO(fsamuel, staraz): Implement this. |
| 61 NOTIMPLEMENTED(); |
| 62 } |
| 63 |
| 64 void CompositorFrameSink::EvictFrame() { |
| 65 support_.EvictFrame(); |
| 66 } |
| 67 |
| 68 void CompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id, |
| 69 const cc::SurfaceSequence& sequence) { |
| 70 support_.Require(local_frame_id, sequence); |
| 71 } |
| 72 |
| 73 void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { |
| 74 support_.Satisfy(sequence); |
| 75 } |
| 76 |
| 77 //////////////////////////////////////////////////////////////////////////////// |
| 78 // cc::CompositorFrameSinkSupportClient overrides: |
| 79 |
| 80 void CompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 81 if (client_) |
| 82 client_->DidReceiveCompositorFrameAck(); |
| 83 } |
| 84 |
| 85 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 86 if (client_) |
| 87 client_->OnBeginFrame(args); |
| 88 } |
| 89 |
| 90 void CompositorFrameSink::ReclaimResources( |
| 91 const cc::ReturnedResourceArray& resources) { |
| 92 if (client_) |
| 93 client_->ReclaimResources(resources); |
| 94 } |
| 95 |
| 96 void CompositorFrameSink::WillDrawSurface() { |
| 97 if (client_) |
| 98 client_->WillDrawSurface(); |
| 99 } |
| 100 |
| 101 } // namespace exo |
OLD | NEW |