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

Side by Side Diff: services/ui/surfaces/gpu_compositor_frame_sink.h

Issue 2654693003: Decouple GpuCompositorFrameSink from DisplayCompositor (Closed)
Patch Set: Fix vars Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ 5 #ifndef SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_
6 #define SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ 6 #define SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "cc/ipc/display_compositor.mojom.h" 13 #include "cc/ipc/display_compositor.mojom.h"
14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
15 #include "cc/surfaces/compositor_frame_sink_delegate.h"
15 #include "cc/surfaces/compositor_frame_sink_support.h" 16 #include "cc/surfaces/compositor_frame_sink_support.h"
16 #include "cc/surfaces/compositor_frame_sink_support_client.h" 17 #include "cc/surfaces/compositor_frame_sink_support_client.h"
17 #include "cc/surfaces/referenced_surface_tracker.h" 18 #include "cc/surfaces/referenced_surface_tracker.h"
18 #include "mojo/public/cpp/bindings/binding.h" 19 #include "mojo/public/cpp/bindings/binding.h"
19 20
20 namespace cc { 21 namespace cc {
21 class Display; 22 class Display;
22 } 23 }
23 24
24 namespace ui { 25 namespace ui {
25 26
26 class DisplayCompositor;
27
28 // Server side representation of a WindowSurface. 27 // Server side representation of a WindowSurface.
29 class GpuCompositorFrameSink 28 class GpuCompositorFrameSink
30 : public cc::CompositorFrameSinkSupportClient, 29 : public cc::CompositorFrameSinkSupportClient,
31 public cc::mojom::MojoCompositorFrameSink, 30 public cc::mojom::MojoCompositorFrameSink,
32 public cc::mojom::MojoCompositorFrameSinkPrivate { 31 public cc::mojom::MojoCompositorFrameSinkPrivate {
33 public: 32 public:
34 GpuCompositorFrameSink( 33 GpuCompositorFrameSink(
35 DisplayCompositor* display_compositor, 34 cc::CompositorFrameSinkDelegate* delegate,
35 cc::SurfaceManager* surface_manager,
36 const cc::FrameSinkId& frame_sink_id, 36 const cc::FrameSinkId& frame_sink_id,
37 std::unique_ptr<cc::Display> display, 37 std::unique_ptr<cc::Display> display,
38 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, 38 std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
39 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 39 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
40 cc::mojom::MojoCompositorFrameSinkClientPtr client); 40 cc::mojom::MojoCompositorFrameSinkClientPtr client);
41 41
42 ~GpuCompositorFrameSink() override; 42 ~GpuCompositorFrameSink() override;
43 43
44 // cc::mojom::MojoCompositorFrameSink: 44 // cc::mojom::MojoCompositorFrameSink:
45 void EvictFrame() override; 45 void EvictFrame() override;
46 void SetNeedsBeginFrame(bool needs_begin_frame) override; 46 void SetNeedsBeginFrame(bool needs_begin_frame) override;
47 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id, 47 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id,
48 cc::CompositorFrame frame) override; 48 cc::CompositorFrame frame) override;
49 void Require(const cc::LocalFrameId& local_frame_id, 49 void Require(const cc::LocalFrameId& local_frame_id,
50 const cc::SurfaceSequence& sequence) override; 50 const cc::SurfaceSequence& sequence) override;
51 void Satisfy(const cc::SurfaceSequence& sequence) override; 51 void Satisfy(const cc::SurfaceSequence& sequence) override;
52 52
53 // cc::mojom::MojoCompositorFrameSinkPrivate: 53 // cc::mojom::MojoCompositorFrameSinkPrivate:
54 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; 54 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override;
55 void RemoveChildFrameSink( 55 void RemoveChildFrameSink(
56 const cc::FrameSinkId& child_frame_sink_id) override; 56 const cc::FrameSinkId& child_frame_sink_id) override;
57 57
58 protected: 58 protected:
59 void OnClientConnectionLost(); 59 void OnClientConnectionLost();
60 void OnPrivateConnectionLost(); 60 void OnPrivateConnectionLost();
61 61
62 DisplayCompositor* const display_compositor_; 62 cc::CompositorFrameSinkDelegate* const delegate_;
63 cc::CompositorFrameSinkSupport support_; 63 cc::CompositorFrameSinkSupport support_;
64 cc::SurfaceManager* const surface_manager_;
64 65
65 private: 66 private:
67 // Adds surface references. For each reference added, this will remove the
68 // temporary reference to the child surface if one exists.
69 void AddSurfaceReferences(
70 const std::vector<cc::SurfaceReference>& references);
71 // Removes surface references.
72 void RemoveSurfaceReferences(
73 const std::vector<cc::SurfaceReference>& references);
74
66 // cc::CompositorFrameSinkSupportClient implementation: 75 // cc::CompositorFrameSinkSupportClient implementation:
67 void DidReceiveCompositorFrameAck() override; 76 void DidReceiveCompositorFrameAck() override;
68 void OnBeginFrame(const cc::BeginFrameArgs& args) override; 77 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
69 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 78 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
70 void WillDrawSurface() override; 79 void WillDrawSurface() override;
71 80
72 // Track the surface references for the surface corresponding to this 81 // Track the surface references for the surface corresponding to this
73 // compositor frame sink. 82 // compositor frame sink.
74 cc::ReferencedSurfaceTracker surface_tracker_; 83 cc::ReferencedSurfaceTracker surface_tracker_;
75 84
76 bool client_connection_lost_ = false; 85 bool client_connection_lost_ = false;
77 bool private_connection_lost_ = false; 86 bool private_connection_lost_ = false;
78 87
79 cc::mojom::MojoCompositorFrameSinkClientPtr client_; 88 cc::mojom::MojoCompositorFrameSinkClientPtr client_;
80 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> 89 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate>
81 compositor_frame_sink_private_binding_; 90 compositor_frame_sink_private_binding_;
82 91
83 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); 92 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink);
84 }; 93 };
85 94
86 } // namespace ui 95 } // namespace ui
87 96
88 #endif // SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ 97 #endif // SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698