Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Side by Side Diff: components/viz/client/client_compositor_frame_sink.h

Issue 2923583002: Remove RendererCompositorFrameSink and use ClientCompositorFrameSink instead (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/viz/client/client_compositor_frame_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 viz { 17 namespace viz {
18 18
19 class LocalSurfaceIdProvider {
Fady Samuel 2017/06/05 15:33:48 Make this a separate file?
Saman Sami 2017/06/05 15:49:22 Done.
20 public:
21 virtual const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame(
22 const cc::CompositorFrame& frame) = 0;
23 };
24
25 class DefaultLocalSurfaceIdProvider : public LocalSurfaceIdProvider {
Fady Samuel 2017/06/05 15:33:48 Separate file?
Saman Sami 2017/06/05 15:49:22 I put in the same file as LocalSurfaceIdProvider.
26 public:
27 const cc::LocalSurfaceId& GetLocalSurfaceIdForFrame(
28 const cc::CompositorFrame& frame) override;
29
30 private:
31 cc::LocalSurfaceId local_surface_id_;
32 gfx::Size surface_size_;
33 float device_scale_factor_ = 0;
34 cc::LocalSurfaceIdAllocator local_surface_id_allocator_;
Fady Samuel 2017/06/05 15:33:48 DISALLOW_COPY_AND_ASSIGN..
Saman Sami 2017/06/05 15:49:22 Done.
35 };
36
19 class ClientCompositorFrameSink 37 class ClientCompositorFrameSink
20 : public cc::CompositorFrameSink, 38 : public cc::CompositorFrameSink,
21 public cc::mojom::MojoCompositorFrameSinkClient, 39 public cc::mojom::MojoCompositorFrameSinkClient,
22 public cc::ExternalBeginFrameSourceClient { 40 public cc::ExternalBeginFrameSourceClient {
23 public: 41 public:
24 ClientCompositorFrameSink( 42 ClientCompositorFrameSink(
25 scoped_refptr<cc::ContextProvider> context_provider, 43 scoped_refptr<cc::ContextProvider> context_provider,
26 scoped_refptr<cc::ContextProvider> worker_context_provider, 44 scoped_refptr<cc::ContextProvider> worker_context_provider,
27 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
28 cc::SharedBitmapManager* shared_bitmap_manager, 46 cc::SharedBitmapManager* shared_bitmap_manager,
29 std::unique_ptr<cc::SyntheticBeginFrameSource> 47 std::unique_ptr<cc::SyntheticBeginFrameSource>
30 synthetic_begin_frame_source, 48 synthetic_begin_frame_source,
31 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, 49 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
32 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, 50 cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
51 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider,
33 bool enable_surface_synchronization); 52 bool enable_surface_synchronization);
34 53
35 ClientCompositorFrameSink( 54 ClientCompositorFrameSink(
36 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, 55 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
37 std::unique_ptr<cc::SyntheticBeginFrameSource> 56 std::unique_ptr<cc::SyntheticBeginFrameSource>
38 synthetic_begin_frame_source, 57 synthetic_begin_frame_source,
39 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, 58 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
40 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, 59 cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
60 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider,
41 bool enable_surface_synchronization); 61 bool enable_surface_synchronization);
42 62
43 ~ClientCompositorFrameSink() override; 63 ~ClientCompositorFrameSink() override;
44 64
45 // cc::CompositorFrameSink implementation. 65 // cc::CompositorFrameSink implementation.
46 bool BindToClient(cc::CompositorFrameSinkClient* client) override; 66 bool BindToClient(cc::CompositorFrameSinkClient* client) override;
47 void DetachFromClient() override; 67 void DetachFromClient() override;
48 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; 68 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override;
49 void SubmitCompositorFrame(cc::CompositorFrame frame) override; 69 void SubmitCompositorFrame(cc::CompositorFrame frame) override;
50 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; 70 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override;
51 71
52 private: 72 private:
53 virtual bool ShouldAllocateNewLocalSurfaceId(
54 const cc::CompositorFrame& frame);
55
56 // cc::mojom::MojoCompositorFrameSinkClient implementation: 73 // cc::mojom::MojoCompositorFrameSinkClient implementation:
57 void DidReceiveCompositorFrameAck( 74 void DidReceiveCompositorFrameAck(
58 const cc::ReturnedResourceArray& resources) override; 75 const cc::ReturnedResourceArray& resources) override;
59 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; 76 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override;
60 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 77 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
61 78
62 // cc::ExternalBeginFrameSourceClient implementation. 79 // cc::ExternalBeginFrameSourceClient implementation.
63 void OnNeedsBeginFrames(bool needs_begin_frames) override; 80 void OnNeedsBeginFrames(bool needs_begin_frames) override;
64 81
65 gfx::Size surface_size_;
66 float device_scale_factor_ = 0.f;
67
68 cc::LocalSurfaceId local_surface_id_; 82 cc::LocalSurfaceId local_surface_id_;
69 cc::LocalSurfaceIdAllocator id_allocator_; 83 std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider_;
70 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; 84 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_;
71 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; 85 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_;
72 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; 86 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_;
73 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; 87 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_;
74 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 88 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
75 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; 89 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_;
76 THREAD_CHECKER(thread_checker_); 90 THREAD_CHECKER(thread_checker_);
77 const bool enable_surface_synchronization_; 91 const bool enable_surface_synchronization_;
78 92
79 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); 93 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink);
80 }; 94 };
81 95
82 } // namespace viz 96 } // namespace viz
83 97
84 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ 98 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_
OLDNEW
« no previous file with comments | « no previous file | components/viz/client/client_compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698