| 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 "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 | 11 |
| 12 namespace exo { | 12 namespace exo { |
| 13 | 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // ExoComopositorFrameSink, public: | 15 // ExoComopositorFrameSink, public: |
| 16 | 16 |
| 17 // static | |
| 18 void CompositorFrameSink::Create( | |
| 19 const cc::FrameSinkId& frame_sink_id, | |
| 20 cc::SurfaceManager* surface_manager, | |
| 21 cc::mojom::MojoCompositorFrameSinkClientPtr client, | |
| 22 cc::mojom::MojoCompositorFrameSinkRequest request) { | |
| 23 std::unique_ptr<CompositorFrameSink> impl = | |
| 24 base::MakeUnique<CompositorFrameSink>(frame_sink_id, surface_manager, | |
| 25 std::move(client)); | |
| 26 CompositorFrameSink* compositor_frame_sink = impl.get(); | |
| 27 compositor_frame_sink->binding_ = | |
| 28 mojo::MakeStrongBinding(std::move(impl), std::move(request)); | |
| 29 } | |
| 30 | |
| 31 CompositorFrameSink::CompositorFrameSink( | 17 CompositorFrameSink::CompositorFrameSink( |
| 32 const cc::FrameSinkId& frame_sink_id, | 18 const cc::FrameSinkId& frame_sink_id, |
| 33 cc::SurfaceManager* surface_manager, | 19 cc::SurfaceManager* surface_manager, |
| 34 cc::mojom::MojoCompositorFrameSinkClientPtr client) | 20 cc::mojom::MojoCompositorFrameSinkClientPtr client) |
| 35 : support_(this, surface_manager, frame_sink_id, nullptr, nullptr), | 21 : support_(this, surface_manager, frame_sink_id, nullptr, nullptr), |
| 36 client_(std::move(client)) {} | 22 client_(std::move(client)) {} |
| 37 | 23 |
| 38 CompositorFrameSink::~CompositorFrameSink() {} | 24 CompositorFrameSink::~CompositorFrameSink() {} |
| 39 | 25 |
| 40 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 58 } |
| 73 | 59 |
| 74 void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { | 60 void CompositorFrameSink::Satisfy(const cc::SurfaceSequence& sequence) { |
| 75 support_.Satisfy(sequence); | 61 support_.Satisfy(sequence); |
| 76 } | 62 } |
| 77 | 63 |
| 78 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
| 79 // cc::CompositorFrameSinkSupportClient overrides: | 65 // cc::CompositorFrameSinkSupportClient overrides: |
| 80 | 66 |
| 81 void CompositorFrameSink::DidReceiveCompositorFrameAck() { | 67 void CompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 82 if (client_) | 68 client_->DidReceiveCompositorFrameAck(); |
| 83 client_->DidReceiveCompositorFrameAck(); | |
| 84 } | 69 } |
| 85 | 70 |
| 86 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { | 71 void CompositorFrameSink::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 87 if (client_) | 72 client_->OnBeginFrame(args); |
| 88 client_->OnBeginFrame(args); | |
| 89 } | 73 } |
| 90 | 74 |
| 91 void CompositorFrameSink::ReclaimResources( | 75 void CompositorFrameSink::ReclaimResources( |
| 92 const cc::ReturnedResourceArray& resources) { | 76 const cc::ReturnedResourceArray& resources) { |
| 93 if (client_) | 77 client_->ReclaimResources(resources); |
| 94 client_->ReclaimResources(resources); | |
| 95 } | 78 } |
| 96 | 79 |
| 97 void CompositorFrameSink::WillDrawSurface() { | 80 void CompositorFrameSink::WillDrawSurface() { |
| 98 if (client_) | 81 client_->WillDrawSurface(); |
| 99 client_->WillDrawSurface(); | |
| 100 } | 82 } |
| 101 | 83 |
| 102 } // namespace exo | 84 } // namespace exo |
| OLD | NEW |