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_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
6 #define COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ | 6 #define COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 10 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
10 #include "cc/output/compositor_frame_sink.h" | 11 #include "cc/output/compositor_frame_sink.h" |
11 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
12 #include "cc/scheduler/begin_frame_source.h" | 13 #include "cc/scheduler/begin_frame_source.h" |
13 #include "cc/surfaces/local_surface_id_allocator.h" | 14 #include "cc/surfaces/local_surface_id_allocator.h" |
14 #include "cc/surfaces/surface_id.h" | 15 #include "cc/surfaces/surface_id.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
16 | 17 |
17 namespace viz { | 18 namespace viz { |
18 | 19 |
(...skipping 20 matching lines...) Expand all Loading... |
39 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, | 40 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, |
40 std::unique_ptr<cc::SyntheticBeginFrameSource> | 41 std::unique_ptr<cc::SyntheticBeginFrameSource> |
41 synthetic_begin_frame_source, | 42 synthetic_begin_frame_source, |
42 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, | 43 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, |
43 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, | 44 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, |
44 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, | 45 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, |
45 bool enable_surface_synchronization); | 46 bool enable_surface_synchronization); |
46 | 47 |
47 ~ClientCompositorFrameSink() override; | 48 ~ClientCompositorFrameSink() override; |
48 | 49 |
| 50 base::WeakPtr<ClientCompositorFrameSink> GetWeakPtr(); |
| 51 |
49 // cc::CompositorFrameSink implementation. | 52 // cc::CompositorFrameSink implementation. |
50 bool BindToClient(cc::CompositorFrameSinkClient* client) override; | 53 bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
51 void DetachFromClient() override; | 54 void DetachFromClient() override; |
52 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; | 55 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; |
53 void SubmitCompositorFrame(cc::CompositorFrame frame) override; | 56 void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
54 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; | 57 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; |
55 | 58 |
56 private: | 59 private: |
57 // cc::mojom::MojoCompositorFrameSinkClient implementation: | 60 // cc::mojom::MojoCompositorFrameSinkClient implementation: |
58 void DidReceiveCompositorFrameAck( | 61 void DidReceiveCompositorFrameAck( |
59 const cc::ReturnedResourceArray& resources) override; | 62 const cc::ReturnedResourceArray& resources) override; |
60 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; | 63 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; |
61 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 64 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
62 | 65 |
63 // cc::ExternalBeginFrameSourceClient implementation. | 66 // cc::ExternalBeginFrameSourceClient implementation. |
64 void OnNeedsBeginFrames(bool needs_begin_frames) override; | 67 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
65 | 68 |
66 cc::LocalSurfaceId local_surface_id_; | 69 cc::LocalSurfaceId local_surface_id_; |
67 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_; | 70 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_; |
68 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; | 71 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
69 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 72 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
70 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; | 73 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; |
71 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; | 74 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; |
72 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; | 75 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; |
73 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; | 76 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; |
74 THREAD_CHECKER(thread_checker_); | 77 THREAD_CHECKER(thread_checker_); |
75 const bool enable_surface_synchronization_; | 78 const bool enable_surface_synchronization_; |
76 | 79 |
| 80 base::WeakPtrFactory<ClientCompositorFrameSink> weak_factory_; |
| 81 |
77 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); | 82 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); |
78 }; | 83 }; |
79 | 84 |
80 } // namespace viz | 85 } // namespace viz |
81 | 86 |
82 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ | 87 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |