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