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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.h

Issue 2940183002: cc: Move ownership of surfaces to SurfaceManager (Closed)
Patch Set: Fix test 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_set> 9 #include <unordered_set>
10 #include <vector> 10 #include <vector>
(...skipping 25 matching lines...) Expand all
36 SurfaceManager* surface_manager, 36 SurfaceManager* surface_manager,
37 const FrameSinkId& frame_sink_id, 37 const FrameSinkId& frame_sink_id,
38 bool is_root, 38 bool is_root,
39 bool handles_frame_sink_id_invalidation, 39 bool handles_frame_sink_id_invalidation,
40 bool needs_sync_points); 40 bool needs_sync_points);
41 41
42 ~CompositorFrameSinkSupport() override; 42 ~CompositorFrameSinkSupport() override;
43 43
44 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } 44 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
45 45
46 Surface* current_surface_for_testing() { return current_surface_.get(); }
47 SurfaceManager* surface_manager() { return surface_manager_; } 46 SurfaceManager* surface_manager() { return surface_manager_; }
48 bool needs_sync_points() { return needs_sync_points_; } 47 bool needs_sync_points() { return needs_sync_points_; }
49 48
50 // SurfaceResourceHolderClient implementation. 49 // SurfaceResourceHolderClient implementation.
51 void ReturnResources(const ReturnedResourceArray& resources) override; 50 void ReturnResources(const ReturnedResourceArray& resources) override;
52 51
53 // FrameSinkManagerClient implementation. 52 // FrameSinkManagerClient implementation.
54 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; 53 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
55 54
56 void EvictCurrentSurface(); 55 void EvictCurrentSurface();
57 void SetNeedsBeginFrame(bool needs_begin_frame); 56 void SetNeedsBeginFrame(bool needs_begin_frame);
58 void DidNotProduceFrame(const BeginFrameAck& ack); 57 void DidNotProduceFrame(const BeginFrameAck& ack);
59 bool SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, 58 bool SubmitCompositorFrame(const LocalSurfaceId& local_surface_id,
60 CompositorFrame frame); 59 CompositorFrame frame);
61 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); 60 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request);
62 void ClaimTemporaryReference(const SurfaceId& surface_id); 61 void ClaimTemporaryReference(const SurfaceId& surface_id);
63 62
64 // TODO(staraz): Move the following 3 methods to private. 63 // TODO(staraz): Move the following 3 methods to private.
65 void ReceiveFromChild(const TransferableResourceArray& resources); 64 void ReceiveFromChild(const TransferableResourceArray& resources);
66 void RefResources(const TransferableResourceArray& resources); 65 void RefResources(const TransferableResourceArray& resources);
67 void UnrefResources(const ReturnedResourceArray& resources); 66 void UnrefResources(const ReturnedResourceArray& resources);
68 67
69 void OnSurfaceActivated(Surface* surface); 68 void OnSurfaceActivated(Surface* surface);
70 69
70 Surface* GetCurrentSurface();
Fady Samuel 2017/06/20 17:29:07 Does this need to be public?
Saman Sami 2017/06/20 22:47:10 It's used in some tests.
71 SurfaceId GetCurrentSurfaceId();
Fady Samuel 2017/06/20 17:29:06 Does this need to be public?
Saman Sami 2017/06/20 22:47:10 I just removed it per your suggestion.
72
71 protected: 73 protected:
72 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, 74 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client,
73 const FrameSinkId& frame_sink_id, 75 const FrameSinkId& frame_sink_id,
74 bool is_root, 76 bool is_root,
75 bool handles_frame_sink_id_invalidation, 77 bool handles_frame_sink_id_invalidation,
76 bool needs_sync_points); 78 bool needs_sync_points);
77 79
78 void Init(SurfaceManager* surface_manager); 80 void Init(SurfaceManager* surface_manager);
79 81
80 private: 82 private:
(...skipping 11 matching lines...) Expand all
92 void DidReceiveCompositorFrameAck(); 94 void DidReceiveCompositorFrameAck();
93 void WillDrawSurface(const LocalSurfaceId& local_surface_id, 95 void WillDrawSurface(const LocalSurfaceId& local_surface_id,
94 const gfx::Rect& damage_rect); 96 const gfx::Rect& damage_rect);
95 97
96 // BeginFrameObserver implementation. 98 // BeginFrameObserver implementation.
97 void OnBeginFrame(const BeginFrameArgs& args) override; 99 void OnBeginFrame(const BeginFrameArgs& args) override;
98 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; 100 const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
99 void OnBeginFrameSourcePausedChanged(bool paused) override; 101 void OnBeginFrameSourcePausedChanged(bool paused) override;
100 102
101 void UpdateNeedsBeginFramesInternal(); 103 void UpdateNeedsBeginFramesInternal();
102 std::unique_ptr<Surface> CreateSurface(const SurfaceInfo& surface_info); 104 Surface* CreateSurface(const SurfaceInfo& surface_info);
103 void DestroyCurrentSurface();
104 105
105 CompositorFrameSinkSupportClient* const client_; 106 CompositorFrameSinkSupportClient* const client_;
106 107
107 SurfaceManager* surface_manager_ = nullptr; 108 SurfaceManager* surface_manager_ = nullptr;
108 109
109 const FrameSinkId frame_sink_id_; 110 const FrameSinkId frame_sink_id_;
111 LocalSurfaceId current_local_surface_id_;
110 112
111 // If this contains a value then a surface reference from the top-level root 113 // If this contains a value then a surface reference from the top-level root
112 // to SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was 114 // to SurfaceId(frame_sink_id_, referenced_local_surface_id_.value()) was
113 // added. This will not contain a value if |is_root_| is false. 115 // added. This will not contain a value if |is_root_| is false.
114 base::Optional<LocalSurfaceId> referenced_local_surface_id_; 116 base::Optional<LocalSurfaceId> referenced_local_surface_id_;
115 117
116 SurfaceResourceHolder surface_resource_holder_; 118 SurfaceResourceHolder surface_resource_holder_;
117 119
118 std::unique_ptr<Surface> current_surface_;
119 // Counts the number of CompositorFrames that have been submitted and have not 120 // Counts the number of CompositorFrames that have been submitted and have not
120 // yet received an ACK. 121 // yet received an ACK.
121 int ack_pending_count_ = 0; 122 int ack_pending_count_ = 0;
122 ReturnedResourceArray surface_returned_resources_; 123 ReturnedResourceArray surface_returned_resources_;
123 124
124 // The begin frame source being observered. Null if none. 125 // The begin frame source being observered. Null if none.
125 BeginFrameSource* begin_frame_source_ = nullptr; 126 BeginFrameSource* begin_frame_source_ = nullptr;
126 127
127 // The last begin frame args generated by the begin frame source. 128 // The last begin frame args generated by the begin frame source.
128 BeginFrameArgs last_begin_frame_args_; 129 BeginFrameArgs last_begin_frame_args_;
(...skipping 21 matching lines...) Expand all
150 const bool handles_frame_sink_id_invalidation_; 151 const bool handles_frame_sink_id_invalidation_;
151 152
152 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 153 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
153 154
154 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 155 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
155 }; 156 };
156 157
157 } // namespace cc 158 } // namespace cc
158 159
159 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 160 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/compositor_frame_sink_support.cc » ('j') | cc/surfaces/compositor_frame_sink_support.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698