OLD | NEW |
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 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return reference_tracker_; | 46 return reference_tracker_; |
47 } | 47 } |
48 | 48 |
49 void EvictFrame(); | 49 void EvictFrame(); |
50 void SetNeedsBeginFrame(bool needs_begin_frame); | 50 void SetNeedsBeginFrame(bool needs_begin_frame); |
51 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, | 51 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, |
52 CompositorFrame frame); | 52 CompositorFrame frame); |
53 void Require(const LocalSurfaceId& local_surface_id, | 53 void Require(const LocalSurfaceId& local_surface_id, |
54 const SurfaceSequence& sequence); | 54 const SurfaceSequence& sequence); |
55 void Satisfy(const SurfaceSequence& sequence); | 55 void Satisfy(const SurfaceSequence& sequence); |
56 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id); | |
57 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id); | |
58 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); | 56 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> request); |
59 void ForceReclaimResources(); | 57 void ForceReclaimResources(); |
60 | 58 |
61 private: | 59 private: |
62 // Update surface references with SurfaceManager for current CompositorFrame | 60 // Update surface references with SurfaceManager for current CompositorFrame |
63 // that has |local_surface_id|. UpdateReferences() must be called on | 61 // that has |local_surface_id|. UpdateReferences() must be called on |
64 // |reference_tracker_| before calling this. Will add and remove top-level | 62 // |reference_tracker_| before calling this. Will add and remove top-level |
65 // root references if |display_| is not null. | 63 // root references if |display_| is not null. |
66 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, | 64 void UpdateSurfaceReferences(const SurfaceId& last_surface_id, |
67 const LocalSurfaceId& local_surface_id); | 65 const LocalSurfaceId& local_surface_id); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Whether a request for begin frames has been issued. | 107 // Whether a request for begin frames has been issued. |
110 bool needs_begin_frame_ = false; | 108 bool needs_begin_frame_ = false; |
111 | 109 |
112 // Whether or not a frame observer has been added. | 110 // Whether or not a frame observer has been added. |
113 bool added_frame_observer_ = false; | 111 bool added_frame_observer_ = false; |
114 | 112 |
115 // Track the surface references for the surface corresponding to this | 113 // Track the surface references for the surface corresponding to this |
116 // compositor frame sink. | 114 // compositor frame sink. |
117 ReferencedSurfaceTracker reference_tracker_; | 115 ReferencedSurfaceTracker reference_tracker_; |
118 | 116 |
119 // The set of BeginFrame children of this CompositorFrameSink. | |
120 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; | |
121 | |
122 const bool is_root_; | 117 const bool is_root_; |
123 | 118 |
124 // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call | 119 // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call |
125 // RegisterFrameSinkId(). | 120 // RegisterFrameSinkId(). |
126 // A surfaceSequence's validity is bound to the lifetime of the parent | 121 // A surfaceSequence's validity is bound to the lifetime of the parent |
127 // FrameSink that created it. We track the lifetime of FrameSinks through | 122 // FrameSink that created it. We track the lifetime of FrameSinks through |
128 // RegisterFrameSinkId and InvalidateFrameSinkId. During startup and GPU | 123 // RegisterFrameSinkId and InvalidateFrameSinkId. During startup and GPU |
129 // restart, a SurfaceSequence created by the top most layer compositor may be | 124 // restart, a SurfaceSequence created by the top most layer compositor may be |
130 // used prior to the creation of the associated CompositorFrameSinkSupport. | 125 // used prior to the creation of the associated CompositorFrameSinkSupport. |
131 // CompositorFrameSinkSupport is created asynchronously when a new GPU channel | 126 // CompositorFrameSinkSupport is created asynchronously when a new GPU channel |
132 // is established. Once we switch to SurfaceReferences, this ordering concern | 127 // is established. Once we switch to SurfaceReferences, this ordering concern |
133 // goes away and we can remove this bool. | 128 // goes away and we can remove this bool. |
134 const bool handles_frame_sink_id_invalidation_; | 129 const bool handles_frame_sink_id_invalidation_; |
135 | 130 |
136 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 131 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
137 | 132 |
138 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 133 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
139 }; | 134 }; |
140 | 135 |
141 } // namespace cc | 136 } // namespace cc |
142 | 137 |
143 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 138 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
OLD | NEW |