| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ | 5 #ifndef COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ |
| 6 #define COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ | 6 #define COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/ipc/compositor_frame_sink.mojom.h" | 10 #include "cc/ipc/compositor_frame_sink.mojom.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/output/layer_tree_frame_sink.h" | 12 #include "cc/output/layer_tree_frame_sink.h" |
| 13 #include "cc/scheduler/begin_frame_source.h" | 13 #include "cc/scheduler/begin_frame_source.h" |
| 14 #include "cc/surfaces/local_surface_id_allocator.h" | 14 #include "cc/surfaces/local_surface_id_allocator.h" |
| 15 #include "cc/surfaces/surface_id.h" | 15 #include "cc/surfaces/surface_id.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 17 |
| 18 namespace aura { |
| 19 class HitTestDataProviderMusTest; |
| 20 } |
| 21 |
| 18 namespace viz { | 22 namespace viz { |
| 19 | 23 |
| 24 class HitTestDataProvider; |
| 20 class LocalSurfaceIdProvider; | 25 class LocalSurfaceIdProvider; |
| 21 | 26 |
| 22 class ClientLayerTreeFrameSink : public cc::LayerTreeFrameSink, | 27 class ClientLayerTreeFrameSink : public cc::LayerTreeFrameSink, |
| 23 public cc::mojom::CompositorFrameSinkClient, | 28 public cc::mojom::CompositorFrameSinkClient, |
| 24 public cc::ExternalBeginFrameSourceClient { | 29 public cc::ExternalBeginFrameSourceClient { |
| 25 public: | 30 public: |
| 26 ClientLayerTreeFrameSink( | 31 ClientLayerTreeFrameSink( |
| 27 scoped_refptr<cc::ContextProvider> context_provider, | 32 scoped_refptr<cc::ContextProvider> context_provider, |
| 28 scoped_refptr<cc::ContextProvider> worker_context_provider, | 33 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 29 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 34 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 30 cc::SharedBitmapManager* shared_bitmap_manager, | 35 cc::SharedBitmapManager* shared_bitmap_manager, |
| 31 std::unique_ptr<cc::SyntheticBeginFrameSource> | 36 std::unique_ptr<cc::SyntheticBeginFrameSource> |
| 32 synthetic_begin_frame_source, | 37 synthetic_begin_frame_source, |
| 33 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info, | 38 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info, |
| 34 cc::mojom::CompositorFrameSinkClientRequest client_request, | 39 cc::mojom::CompositorFrameSinkClientRequest client_request, |
| 40 std::unique_ptr<HitTestDataProvider> hit_test_data_provider, |
| 35 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, | 41 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, |
| 36 bool enable_surface_synchronization); | 42 bool enable_surface_synchronization); |
| 37 | 43 |
| 38 ClientLayerTreeFrameSink( | 44 ClientLayerTreeFrameSink( |
| 39 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, | 45 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, |
| 40 std::unique_ptr<cc::SyntheticBeginFrameSource> | 46 std::unique_ptr<cc::SyntheticBeginFrameSource> |
| 41 synthetic_begin_frame_source, | 47 synthetic_begin_frame_source, |
| 42 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info, | 48 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info, |
| 43 cc::mojom::CompositorFrameSinkClientRequest client_request, | 49 cc::mojom::CompositorFrameSinkClientRequest client_request, |
| 50 std::unique_ptr<HitTestDataProvider> hit_test_data_provider, |
| 44 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, | 51 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, |
| 45 bool enable_surface_synchronization); | 52 bool enable_surface_synchronization); |
| 46 | 53 |
| 47 ~ClientLayerTreeFrameSink() override; | 54 ~ClientLayerTreeFrameSink() override; |
| 48 | 55 |
| 49 base::WeakPtr<ClientLayerTreeFrameSink> GetWeakPtr(); | 56 base::WeakPtr<ClientLayerTreeFrameSink> GetWeakPtr(); |
| 50 | 57 |
| 51 // cc::LayerTreeFrameSink implementation. | 58 // cc::LayerTreeFrameSink implementation. |
| 52 bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; | 59 bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; |
| 53 void DetachFromClient() override; | 60 void DetachFromClient() override; |
| 54 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; | 61 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; |
| 55 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | 62 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| 56 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; | 63 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; |
| 57 | 64 |
| 58 private: | 65 private: |
| 66 friend class aura::HitTestDataProviderMusTest; |
| 67 |
| 59 // cc::mojom::CompositorFrameSinkClient implementation: | 68 // cc::mojom::CompositorFrameSinkClient implementation: |
| 60 void DidReceiveCompositorFrameAck( | 69 void DidReceiveCompositorFrameAck( |
| 61 const std::vector<cc::ReturnedResource>& resources) override; | 70 const std::vector<cc::ReturnedResource>& resources) override; |
| 62 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; | 71 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; |
| 63 void ReclaimResources( | 72 void ReclaimResources( |
| 64 const std::vector<cc::ReturnedResource>& resources) override; | 73 const std::vector<cc::ReturnedResource>& resources) override; |
| 65 | 74 |
| 66 // cc::ExternalBeginFrameSourceClient implementation. | 75 // cc::ExternalBeginFrameSourceClient implementation. |
| 67 void OnNeedsBeginFrames(bool needs_begin_frames) override; | 76 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
| 68 | 77 |
| 69 static void OnMojoConnectionError(uint32_t custom_reason, | 78 static void OnMojoConnectionError(uint32_t custom_reason, |
| 70 const std::string& description); | 79 const std::string& description); |
| 71 | 80 |
| 72 cc::LocalSurfaceId local_surface_id_; | 81 cc::LocalSurfaceId local_surface_id_; |
| 82 std::unique_ptr<HitTestDataProvider> hit_test_data_provider_; |
| 73 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_; | 83 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_; |
| 74 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | 84 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| 75 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 85 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
| 76 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info_; | 86 cc::mojom::CompositorFrameSinkPtrInfo compositor_frame_sink_info_; |
| 77 cc::mojom::CompositorFrameSinkClientRequest client_request_; | 87 cc::mojom::CompositorFrameSinkClientRequest client_request_; |
| 78 cc::mojom::CompositorFrameSinkPtr compositor_frame_sink_; | 88 cc::mojom::CompositorFrameSinkPtr compositor_frame_sink_; |
| 79 mojo::Binding<cc::mojom::CompositorFrameSinkClient> client_binding_; | 89 mojo::Binding<cc::mojom::CompositorFrameSinkClient> client_binding_; |
| 80 THREAD_CHECKER(thread_checker_); | 90 THREAD_CHECKER(thread_checker_); |
| 81 const bool enable_surface_synchronization_; | 91 const bool enable_surface_synchronization_; |
| 82 | 92 |
| 83 base::WeakPtrFactory<ClientLayerTreeFrameSink> weak_factory_; | 93 base::WeakPtrFactory<ClientLayerTreeFrameSink> weak_factory_; |
| 84 | 94 |
| 85 DISALLOW_COPY_AND_ASSIGN(ClientLayerTreeFrameSink); | 95 DISALLOW_COPY_AND_ASSIGN(ClientLayerTreeFrameSink); |
| 86 }; | 96 }; |
| 87 | 97 |
| 88 } // namespace viz | 98 } // namespace viz |
| 89 | 99 |
| 90 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ | 100 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ |
| OLD | NEW |