Chromium Code Reviews| 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, | |
| 35 surface_manager, | |
| 36 frame_sink_id, | |
| 37 std::unique_ptr<cc::Display>()), | |
| 38 client_(std::move(client)) {} | |
| 39 | |
| 40 CompositorFrameSink::~CompositorFrameSink() {} | |
| 41 | |
| 42 //////////////////////////////////////////////////////////////////////////////// | |
| 43 // cc::mojom::MojoCompositorFrameSink overrides: | |
| 44 | |
| 45 void CompositorFrameSink::SetNeedsBeginFrame(bool needs_begin_frame) { | |
| 46 support_.SetNeedsBeginFrame(needs_begin_frame); | |
| 47 } | |
| 48 | |
| 49 void CompositorFrameSink::SubmitCompositorFrame( | |
| 50 const cc::LocalFrameId& local_frame_id, | |
| 51 cc::CompositorFrame frame) { | |
| 52 support_.SubmitCompositorFrame(local_frame_id, std::move(frame)); | |
| 53 } | |
| 54 | |
| 55 void CompositorFrameSink::EvictFrame() { | |
| 56 support_.EvictFrame(); | |
| 57 } | |
| 58 | |
| 59 void CompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id, | |
| 60 const cc::SurfaceSequence& sequence) { | |
| 61 support_.Require(local_frame_id, sequence); | |
| 62 } | |
| 63 | |
| 64 void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { | |
| 65 support_.Satisfy(sequence); | |
| 66 } | |
| 67 | |
| 68 //////////////////////////////////////////////////////////////////////////////// | |
| 69 // ExoComopositorFrameSink, private: | |
|
reveman
2016/12/07 00:46:56
nit: "cc::CompositorFrameSinkSupportClient overrid
Alex Z.
2016/12/07 20:09:34
Done.
| |
| 70 | |
| 71 void CompositorFrameSink::DidReceiveCompositorFrameAck() { | |
| 72 if (!client_) | |
|
reveman
2016/12/07 00:46:56
nit: here you early out when client_ == null but f
Alex Z.
2016/12/07 20:09:34
Done.
| |
| 73 return; | |
| 74 | |
| 75 client_->DidReceiveCompositorFrameAck(); | |
| 76 } | |
| 77 | |
| 78 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { | |
| 79 if (client_) | |
| 80 client_->OnBeginFrame(args); | |
| 81 } | |
| 82 | |
| 83 void CompositorFrameSink::ReclaimResources( | |
| 84 const cc::ReturnedResourceArray& resources) { | |
| 85 if (client_) | |
| 86 client_->ReclaimResources(resources); | |
| 87 } | |
| 88 | |
| 89 void CompositorFrameSink::WillDrawSurface() { | |
| 90 if (client_) | |
| 91 client_->WillDrawSurface(); | |
| 92 } | |
| 93 | |
| 94 } // namespace exo | |
| OLD | NEW |