| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_WINDOW_COMPOSITOR_FRAME_SINK_H_ | |
| 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | |
| 10 #include "cc/output/compositor_frame_sink.h" | |
| 11 #include "cc/output/context_provider.h" | |
| 12 #include "cc/scheduler/begin_frame_source.h" | |
| 13 #include "cc/surfaces/local_surface_id_allocator.h" | |
| 14 #include "cc/surfaces/surface_id.h" | |
| 15 #include "mojo/public/cpp/bindings/binding.h" | |
| 16 | |
| 17 namespace ui { | |
| 18 | |
| 19 class ClientCompositorFrameSink | |
| 20 : public cc::CompositorFrameSink, | |
| 21 public cc::mojom::MojoCompositorFrameSinkClient, | |
| 22 public cc::ExternalBeginFrameSourceClient { | |
| 23 public: | |
| 24 ClientCompositorFrameSink( | |
| 25 scoped_refptr<cc::ContextProvider> context_provider, | |
| 26 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 27 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, | |
| 28 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, | |
| 29 bool enable_surface_synchronization); | |
| 30 | |
| 31 ~ClientCompositorFrameSink() override; | |
| 32 | |
| 33 // cc::CompositorFrameSink implementation. | |
| 34 bool BindToClient(cc::CompositorFrameSinkClient* client) override; | |
| 35 void DetachFromClient() override; | |
| 36 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; | |
| 37 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | |
| 38 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; | |
| 39 | |
| 40 private: | |
| 41 // cc::mojom::MojoCompositorFrameSinkClient implementation: | |
| 42 void DidReceiveCompositorFrameAck( | |
| 43 const cc::ReturnedResourceArray& resources) override; | |
| 44 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; | |
| 45 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | |
| 46 | |
| 47 // cc::ExternalBeginFrameSourceClient implementation. | |
| 48 void OnNeedsBeginFrames(bool needs_begin_frames) override; | |
| 49 | |
| 50 gfx::Size last_submitted_frame_size_; | |
| 51 cc::LocalSurfaceId local_surface_id_; | |
| 52 cc::LocalSurfaceIdAllocator id_allocator_; | |
| 53 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | |
| 54 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; | |
| 55 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; | |
| 56 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; | |
| 57 std::unique_ptr<mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>> | |
| 58 client_binding_; | |
| 59 std::unique_ptr<base::ThreadChecker> thread_checker_; | |
| 60 const bool enable_surface_synchronization_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); | |
| 63 }; | |
| 64 | |
| 65 } // namespace ui | |
| 66 | |
| 67 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ | |
| OLD | NEW |