| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 9 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| 10 #include "cc/output/compositor_frame_sink.h" | 10 #include "cc/output/compositor_frame_sink.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/scheduler/begin_frame_source.h" | 12 #include "cc/scheduler/begin_frame_source.h" |
| 13 #include "cc/surfaces/local_surface_id_allocator.h" | 13 #include "cc/surfaces/local_surface_id_allocator.h" |
| 14 #include "cc/surfaces/surface_id.h" | 14 #include "cc/surfaces/surface_id.h" |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 class ClientCompositorFrameSinkBinding; | 19 class ClientCompositorFrameSinkBinding; |
| 20 | 20 |
| 21 class ClientCompositorFrameSink | 21 class ClientCompositorFrameSink |
| 22 : public cc::CompositorFrameSink, | 22 : public cc::CompositorFrameSink, |
| 23 public cc::mojom::MojoCompositorFrameSinkClient, | 23 public cc::mojom::MojoCompositorFrameSinkClient, |
| 24 public cc::ExternalBeginFrameSourceClient { | 24 public cc::ExternalBeginFrameSourceClient { |
| 25 public: | 25 public: |
| 26 // static | 26 // static |
| 27 static std::unique_ptr<ClientCompositorFrameSink> Create( | 27 static std::unique_ptr<ClientCompositorFrameSink> Create( |
| 28 const cc::FrameSinkId& frame_sink_id, | |
| 29 scoped_refptr<cc::ContextProvider> context_provider, | 28 scoped_refptr<cc::ContextProvider> context_provider, |
| 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 29 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 31 std::unique_ptr<ClientCompositorFrameSinkBinding>* | 30 std::unique_ptr<ClientCompositorFrameSinkBinding>* |
| 32 compositor_frame_sink_binding); | 31 compositor_frame_sink_binding, |
| 32 bool enable_surface_synchronization); |
| 33 | 33 |
| 34 ~ClientCompositorFrameSink() override; | 34 ~ClientCompositorFrameSink() override; |
| 35 | 35 |
| 36 // cc::CompositorFrameSink implementation. | 36 // cc::CompositorFrameSink implementation. |
| 37 bool BindToClient(cc::CompositorFrameSinkClient* client) override; | 37 bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
| 38 void DetachFromClient() override; | 38 void DetachFromClient() override; |
| 39 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; | 39 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; |
| 40 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | 40 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 ClientCompositorFrameSink( | 43 ClientCompositorFrameSink( |
| 44 const cc::FrameSinkId& frame_sink_id, | |
| 45 scoped_refptr<cc::ContextProvider> context_provider, | 44 scoped_refptr<cc::ContextProvider> context_provider, |
| 46 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 47 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, | 46 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, |
| 48 cc::mojom::MojoCompositorFrameSinkClientRequest client_request); | 47 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, |
| 48 bool enable_surface_synchronization); |
| 49 | 49 |
| 50 // cc::mojom::MojoCompositorFrameSinkClient implementation: | 50 // cc::mojom::MojoCompositorFrameSinkClient implementation: |
| 51 void DidReceiveCompositorFrameAck( | 51 void DidReceiveCompositorFrameAck( |
| 52 const cc::ReturnedResourceArray& resources) override; | 52 const cc::ReturnedResourceArray& resources) override; |
| 53 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; | 53 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; |
| 54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 55 | 55 |
| 56 // cc::ExternalBeginFrameSourceClient implementation. | 56 // cc::ExternalBeginFrameSourceClient implementation. |
| 57 void OnNeedsBeginFrames(bool needs_begin_frames) override; | 57 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
| 58 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; | 58 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
| 59 | 59 |
| 60 gfx::Size last_submitted_frame_size_; | 60 gfx::Size last_submitted_frame_size_; |
| 61 cc::LocalSurfaceId local_surface_id_; | 61 cc::LocalSurfaceId local_surface_id_; |
| 62 cc::LocalSurfaceIdAllocator id_allocator_; | 62 cc::LocalSurfaceIdAllocator id_allocator_; |
| 63 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | 63 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 64 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; | 64 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; |
| 65 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; | 65 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; |
| 66 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; | 66 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; |
| 67 std::unique_ptr<mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>> | 67 std::unique_ptr<mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>> |
| 68 client_binding_; | 68 client_binding_; |
| 69 std::unique_ptr<base::ThreadChecker> thread_checker_; | 69 std::unique_ptr<base::ThreadChecker> thread_checker_; |
| 70 const cc::FrameSinkId frame_sink_id_; | 70 const bool enable_surface_synchronization_; |
| 71 bool enable_surface_synchronization_ = false; | |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); | 72 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 // A ClientCompositorFrameSinkBinding is a bundle of mojo interfaces that is | 75 // A ClientCompositorFrameSinkBinding is a bundle of mojo interfaces that is |
| 77 // created by ClientCompositorFrameSink::Create and is used by or implemented by | 76 // created by ClientCompositorFrameSink::Create and is used by or implemented by |
| 78 // Mus when a window is attached to a frame-sink.. | 77 // Mus when a window is attached to a frame-sink.. |
| 79 // ClientCompositorFrameSinkBinding has no standalone functionality. Its purpose | 78 // ClientCompositorFrameSinkBinding has no standalone functionality. Its purpose |
| 80 // is to allow safely creating and attaching a CompositorFrameSink on one | 79 // is to allow safely creating and attaching a CompositorFrameSink on one |
| 81 // thread and using it on another. | 80 // thread and using it on another. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 95 compositor_frame_sink_client); | 94 compositor_frame_sink_client); |
| 96 | 95 |
| 97 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request_; | 96 cc::mojom::MojoCompositorFrameSinkRequest compositor_frame_sink_request_; |
| 98 cc::mojom::MojoCompositorFrameSinkClientPtrInfo compositor_frame_sink_client_; | 97 cc::mojom::MojoCompositorFrameSinkClientPtrInfo compositor_frame_sink_client_; |
| 99 | 98 |
| 100 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSinkBinding); | 99 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSinkBinding); |
| 101 }; | 100 }; |
| 102 } // namespace ui | 101 } // namespace ui |
| 103 | 102 |
| 104 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ | 103 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |