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

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

Issue 2875753002: Implement aura::WindowPortMus::CreateCompositorFrameSink() (Closed)
Patch Set: Address review issues. 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
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 ClientCompositorFrameSink 19 class ClientCompositorFrameSink
20 : public cc::CompositorFrameSink, 20 : public cc::CompositorFrameSink,
21 public cc::mojom::MojoCompositorFrameSinkClient, 21 public cc::mojom::MojoCompositorFrameSinkClient,
22 public cc::ExternalBeginFrameSourceClient { 22 public cc::ExternalBeginFrameSourceClient {
23 public: 23 public:
24 // If |generate_local_surface_id| is true, a local surface id will be
25 // generated for a new frame with different size, otherwise the
26 // |SetLocalSurfaceId| should be used for providing a valid local surface
27 // id.
24 ClientCompositorFrameSink( 28 ClientCompositorFrameSink(
25 scoped_refptr<cc::ContextProvider> context_provider, 29 scoped_refptr<cc::ContextProvider> context_provider,
26 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
27 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, 31 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info,
28 cc::mojom::MojoCompositorFrameSinkClientRequest client_request, 32 cc::mojom::MojoCompositorFrameSinkClientRequest client_request,
29 bool enable_surface_synchronization); 33 bool generate_local_surface_id);
30 34
31 ~ClientCompositorFrameSink() override; 35 ~ClientCompositorFrameSink() override;
32 36
37 using SurfaceChangedCallback =
38 base::Callback<void(const cc::LocalSurfaceId&, const gfx::Size&)>;
39 // Set a callback which will be called when the surface is changed.
40 void SetSurfaceChangedCallback(const SurfaceChangedCallback& callback);
41
33 // cc::CompositorFrameSink implementation. 42 // cc::CompositorFrameSink implementation.
34 bool BindToClient(cc::CompositorFrameSinkClient* client) override; 43 bool BindToClient(cc::CompositorFrameSinkClient* client) override;
35 void DetachFromClient() override; 44 void DetachFromClient() override;
36 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; 45 void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override;
37 void SubmitCompositorFrame(cc::CompositorFrame frame) override; 46 void SubmitCompositorFrame(cc::CompositorFrame frame) override;
38 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; 47 void DidNotProduceFrame(const cc::BeginFrameAck& ack) override;
39 48
40 private: 49 private:
41 // cc::mojom::MojoCompositorFrameSinkClient implementation: 50 // cc::mojom::MojoCompositorFrameSinkClient implementation:
42 void DidReceiveCompositorFrameAck( 51 void DidReceiveCompositorFrameAck(
43 const cc::ReturnedResourceArray& resources) override; 52 const cc::ReturnedResourceArray& resources) override;
44 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; 53 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override;
45 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
46 55
47 // cc::ExternalBeginFrameSourceClient implementation. 56 // cc::ExternalBeginFrameSourceClient implementation.
48 void OnNeedsBeginFrames(bool needs_begin_frames) override; 57 void OnNeedsBeginFrames(bool needs_begin_frames) override;
49 58
50 gfx::Size last_submitted_frame_size_; 59 gfx::Size last_submitted_frame_size_;
51 cc::LocalSurfaceId local_surface_id_; 60 cc::LocalSurfaceId local_surface_id_;
52 cc::LocalSurfaceIdAllocator id_allocator_; 61 cc::LocalSurfaceIdAllocator id_allocator_;
53 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; 62 std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_;
54 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_; 63 cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info_;
55 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; 64 cc::mojom::MojoCompositorFrameSinkClientRequest client_request_;
56 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 65 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
57 std::unique_ptr<mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>> 66 std::unique_ptr<mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>>
58 client_binding_; 67 client_binding_;
59 THREAD_CHECKER(thread_checker_); 68 THREAD_CHECKER(thread_checker_);
60 const bool enable_surface_synchronization_; 69 const bool generate_local_surface_id_;
70
71 SurfaceChangedCallback surface_changed_callback_;
61 72
62 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); 73 DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink);
63 }; 74 };
64 75
65 } // namespace viz 76 } // namespace viz
66 77
67 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ 78 #endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698