| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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 #ifndef SERVICES_UI_WS_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ | |
| 6 #define SERVICES_UI_WS_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ | |
| 7 | |
| 8 #include "cc/ipc/frame_sink_manager.mojom.h" | |
| 9 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | |
| 10 #include "cc/output/compositor_frame_sink.h" | |
| 11 #include "cc/scheduler/begin_frame_source.h" | |
| 12 #include "cc/surfaces/local_surface_id.h" | |
| 13 #include "cc/surfaces/local_surface_id_allocator.h" | |
| 14 #include "mojo/public/cpp/bindings/binding.h" | |
| 15 #include "ui/gfx/geometry/size.h" | |
| 16 | |
| 17 namespace base { | |
| 18 class ThreadChecker; | |
| 19 } // namespace base | |
| 20 | |
| 21 namespace ui { | |
| 22 namespace ws { | |
| 23 | |
| 24 // DisplayClientCompositorFrameSink submits CompositorFrames to a | |
| 25 // MojoCompositorFrameSink, with the client's frame being the root surface of | |
| 26 // the Display. | |
| 27 class DisplayClientCompositorFrameSink | |
| 28 : public cc::CompositorFrameSink, | |
| 29 public cc::mojom::MojoCompositorFrameSinkClient, | |
| 30 public cc::ExternalBeginFrameSourceClient { | |
| 31 public: | |
| 32 DisplayClientCompositorFrameSink( | |
| 33 const cc::FrameSinkId& frame_sink_id, | |
| 34 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink, | |
| 35 cc::mojom::DisplayPrivateAssociatedPtr display_private, | |
| 36 cc::mojom::MojoCompositorFrameSinkClientRequest client_request); | |
| 37 | |
| 38 ~DisplayClientCompositorFrameSink() override; | |
| 39 | |
| 40 // cc::CompositorFrameSink implementation: | |
| 41 bool BindToClient(cc::CompositorFrameSinkClient* client) override; | |
| 42 void DetachFromClient() override; | |
| 43 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | |
| 44 | |
| 45 private: | |
| 46 // cc::mojom::MojoCompositorFrameSinkClient implementation: | |
| 47 void DidReceiveCompositorFrameAck( | |
| 48 const cc::ReturnedResourceArray& resources) override; | |
| 49 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; | |
| 50 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | |
| 51 | |
| 52 // cc::ExternalBeginFrameSourceClient implementation: | |
| 53 void OnNeedsBeginFrames(bool needs_begin_frame) override; | |
| 54 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; | |
| 55 | |
| 56 gfx::Size last_submitted_frame_size_; | |
| 57 cc::LocalSurfaceId local_surface_id_; | |
| 58 cc::LocalSurfaceIdAllocator id_allocator_; | |
| 59 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; | |
| 60 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_; | |
| 61 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; | |
| 62 cc::mojom::DisplayPrivateAssociatedPtr display_private_; | |
| 63 std::unique_ptr<base::ThreadChecker> thread_checker_; | |
| 64 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | |
| 65 const cc::FrameSinkId frame_sink_id_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(DisplayClientCompositorFrameSink); | |
| 68 }; | |
| 69 | |
| 70 } // namespace ws | |
| 71 } // namespace ui | |
| 72 | |
| 73 #endif // SERVICES_UI_WS_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ | |
| OLD | NEW |