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

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

Issue 2795683003: [cc]Replace use of SurfaceFactory with CompositorFrameSinkSupport in tests (Closed)
Patch Set: Remove SurfaceFacotry Usages in SurfaceAggregatorTest And Address Comments Created 3 years, 8 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 void EvictFrame(); 50 void EvictFrame();
51 void SetNeedsBeginFrame(bool needs_begin_frame); 51 void SetNeedsBeginFrame(bool needs_begin_frame);
52 void BeginFrameDidNotSwap(const BeginFrameAck& ack); 52 void BeginFrameDidNotSwap(const BeginFrameAck& ack);
53 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, 53 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id,
54 CompositorFrame frame); 54 CompositorFrame frame);
55 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); 55 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request);
56 void ForceReclaimResources(); 56 void ForceReclaimResources();
57 void ClaimTemporaryReference(const SurfaceId& surface_id); 57 void ClaimTemporaryReference(const SurfaceId& surface_id);
58 58
59 BeginFrameSource* BeginFrameSourceForTesting() const;
60 const ReturnedResourceArray& LastReturnedResourcesForTesting() const;
61 const gfx::Rect& last_damage_rect() { return last_damage_rect_; }
62 const LocalSurfaceId& last_local_surface_id() {
63 return last_local_surface_id_;
64 }
65
59 private: 66 private:
60 // Update surface references with SurfaceManager for current CompositorFrame 67 // Update surface references with SurfaceManager for current CompositorFrame
61 // that has |local_surface_id|. UpdateReferences() must be called on 68 // that has |local_surface_id|. UpdateReferences() must be called on
62 // |reference_tracker_| before calling this. Will add and remove top-level 69 // |reference_tracker_| before calling this. Will add and remove top-level
63 // root references if |display_| is not null. 70 // root references if |display_| is not null.
64 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, 71 void UpdateSurfaceReferences(const SurfaceId& last_surface_id,
65 const LocalSurfaceId& local_surface_id); 72 const LocalSurfaceId& local_surface_id);
66 73
67 void AddTopLevelRootReference(const SurfaceId& surface_id); 74 void AddTopLevelRootReference(const SurfaceId& surface_id);
68 void RemoveTopLevelRootReference(const SurfaceId& surface_id); 75 void RemoveTopLevelRootReference(const SurfaceId& surface_id);
(...skipping 21 matching lines...) Expand all
90 97
91 SurfaceManager* const surface_manager_; 98 SurfaceManager* const surface_manager_;
92 99
93 const FrameSinkId frame_sink_id_; 100 const FrameSinkId frame_sink_id_;
94 101
95 SurfaceFactory surface_factory_; 102 SurfaceFactory surface_factory_;
96 // Counts the number of CompositorFrames that have been submitted and have not 103 // Counts the number of CompositorFrames that have been submitted and have not
97 // yet received an ACK. 104 // yet received an ACK.
98 int ack_pending_count_ = 0; 105 int ack_pending_count_ = 0;
99 ReturnedResourceArray surface_returned_resources_; 106 ReturnedResourceArray surface_returned_resources_;
107 ReturnedResourceArray last_returned_resources_;
100 108
101 // The begin frame source being observered. Null if none. 109 // The begin frame source being observered. Null if none.
102 BeginFrameSource* begin_frame_source_ = nullptr; 110 BeginFrameSource* begin_frame_source_ = nullptr;
103 111
104 // The last begin frame args generated by the begin frame source. 112 // The last begin frame args generated by the begin frame source.
105 BeginFrameArgs last_begin_frame_args_; 113 BeginFrameArgs last_begin_frame_args_;
106 114
107 // Whether a request for begin frames has been issued. 115 // Whether a request for begin frames has been issued.
108 bool needs_begin_frame_ = false; 116 bool needs_begin_frame_ = false;
109 117
110 // Whether or not a frame observer has been added. 118 // Whether or not a frame observer has been added.
111 bool added_frame_observer_ = false; 119 bool added_frame_observer_ = false;
112 120
113 // Track the surface references for the surface corresponding to this 121 // Track the surface references for the surface corresponding to this
114 // compositor frame sink. 122 // compositor frame sink.
115 ReferencedSurfaceTracker reference_tracker_; 123 ReferencedSurfaceTracker reference_tracker_;
116 124
117 const bool is_root_; 125 const bool is_root_;
126 gfx::Rect last_damage_rect_;
127 LocalSurfaceId last_local_surface_id_;
118 128
119 // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call 129 // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call
120 // RegisterFrameSinkId(). 130 // RegisterFrameSinkId().
121 // A surfaceSequence's validity is bound to the lifetime of the parent 131 // A surfaceSequence's validity is bound to the lifetime of the parent
122 // FrameSink that created it. We track the lifetime of FrameSinks through 132 // FrameSink that created it. We track the lifetime of FrameSinks through
123 // RegisterFrameSinkId and InvalidateFrameSinkId. During startup and GPU 133 // RegisterFrameSinkId and InvalidateFrameSinkId. During startup and GPU
124 // restart, a SurfaceSequence created by the top most layer compositor may be 134 // restart, a SurfaceSequence created by the top most layer compositor may be
125 // used prior to the creation of the associated CompositorFrameSinkSupport. 135 // used prior to the creation of the associated CompositorFrameSinkSupport.
126 // CompositorFrameSinkSupport is created asynchronously when a new GPU channel 136 // CompositorFrameSinkSupport is created asynchronously when a new GPU channel
127 // is established. Once we switch to SurfaceReferences, this ordering concern 137 // is established. Once we switch to SurfaceReferences, this ordering concern
128 // goes away and we can remove this bool. 138 // goes away and we can remove this bool.
129 const bool handles_frame_sink_id_invalidation_; 139 const bool handles_frame_sink_id_invalidation_;
130 140
131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 141 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
132 142
133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 143 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
134 }; 144 };
135 145
136 } // namespace cc 146 } // namespace cc
137 147
138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 148 #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