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_ = | |
|
Fady Samuel
2016/12/08 13:16:56
This is really weird. Anyhow, I would recommend ma
Alex Z.
2016/12/09 16:16:27
Done.
| |
| 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>()), | |
|
Fady Samuel
2016/12/08 13:16:56
nullptr
Alex Z.
2016/12/09 16:16:27
Done.
| |
| 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::AddSurfaceReferences( | |
| 56 const std::vector<cc::SurfaceReference>& references) { | |
| 57 // TODO(fsamuel, staraz): Implement this. | |
| 58 NOTIMPLEMENTED(); | |
| 59 } | |
| 60 | |
| 61 void CompositorFrameSink::RemoveSurfaceReferences( | |
| 62 const std::vector<cc::SurfaceReference>& references) { | |
| 63 // TODO(fsamuel, staraz): Implement this. | |
| 64 NOTIMPLEMENTED(); | |
| 65 } | |
| 66 | |
| 67 void CompositorFrameSink::EvictFrame() { | |
| 68 support_.EvictFrame(); | |
| 69 } | |
| 70 | |
| 71 void CompositorFrameSink::Require(const cc::LocalFrameId& local_frame_id, | |
| 72 const cc::SurfaceSequence& sequence) { | |
| 73 support_.Require(local_frame_id, sequence); | |
| 74 } | |
| 75 | |
| 76 void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { | |
| 77 support_.Satisfy(sequence); | |
| 78 } | |
| 79 | |
| 80 //////////////////////////////////////////////////////////////////////////////// | |
| 81 // cc::CompositorFrameSinkSupportClient overrides: | |
| 82 | |
| 83 void CompositorFrameSink::DidReceiveCompositorFrameAck() { | |
| 84 if (client_) | |
| 85 client_->DidReceiveCompositorFrameAck(); | |
| 86 } | |
| 87 | |
| 88 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { | |
| 89 if (client_) | |
| 90 client_->OnBeginFrame(args); | |
| 91 } | |
| 92 | |
| 93 void CompositorFrameSink::ReclaimResources( | |
| 94 const cc::ReturnedResourceArray& resources) { | |
| 95 if (client_) | |
| 96 client_->ReclaimResources(resources); | |
| 97 } | |
| 98 | |
| 99 void CompositorFrameSink::WillDrawSurface() { | |
| 100 if (client_) | |
| 101 client_->WillDrawSurface(); | |
| 102 } | |
| 103 | |
| 104 } // namespace exo | |
| OLD | NEW |