| 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_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
| 7 |
| 8 #include "cc/ipc/display_compositor.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 class DisplayClientCompositorFrameSink |
| 25 : public cc::CompositorFrameSink, |
| 26 public cc::mojom::MojoCompositorFrameSinkClient, |
| 27 public cc::ExternalBeginFrameSourceClient { |
| 28 public: |
| 29 DisplayClientCompositorFrameSink( |
| 30 const cc::FrameSinkId& frame_sink_id, |
| 31 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink, |
| 32 cc::mojom::DisplayPrivateAssociatedPtr display_private, |
| 33 cc::mojom::MojoCompositorFrameSinkClientRequest client_request); |
| 34 |
| 35 ~DisplayClientCompositorFrameSink() override; |
| 36 |
| 37 // cc::CompositorFrameSink implementation: |
| 38 bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
| 39 void DetachFromClient() override; |
| 40 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 41 |
| 42 private: |
| 43 // cc::mojom::MojoCompositorFrameSinkClient implementation: |
| 44 void DidReceiveCompositorFrameAck() override; |
| 45 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; |
| 46 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 47 void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, |
| 48 const gfx::Rect& damage_rect) override; |
| 49 |
| 50 // cc::ExternalBeginFrameSourceClient implementation: |
| 51 void OnNeedsBeginFrames(bool needs_begin_frame) override; |
| 52 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
| 53 |
| 54 gfx::Size last_submitted_frame_size_; |
| 55 cc::LocalSurfaceId local_surface_id_; |
| 56 cc::LocalSurfaceIdAllocator id_allocator_; |
| 57 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; |
| 58 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_; |
| 59 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; |
| 60 cc::mojom::DisplayPrivateAssociatedPtr display_private_; |
| 61 std::unique_ptr<base::ThreadChecker> thread_checker_; |
| 62 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 63 const cc::FrameSinkId frame_sink_id_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(DisplayClientCompositorFrameSink); |
| 66 }; |
| 67 |
| 68 } // namspace ws |
| 69 } // namespace ui |
| 70 |
| 71 #endif // SERVICES_UI_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |