| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SURFACE_MANAGER_H_ | 5 #ifndef CC_SURFACES_SURFACE_MANAGER_H_ |
| 6 #define CC_SURFACES_SURFACE_MANAGER_H_ | 6 #define CC_SURFACES_SURFACE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 friend class SurfaceManagerRefTest; | 140 friend class SurfaceManagerRefTest; |
| 141 | 141 |
| 142 using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>; | 142 using SurfaceIdSet = std::unordered_set<SurfaceId, SurfaceIdHash>; |
| 143 | 143 |
| 144 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, | 144 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 145 BeginFrameSource* source); | 145 BeginFrameSource* source); |
| 146 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, | 146 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 147 BeginFrameSource* source); | 147 BeginFrameSource* source); |
| 148 |
| 148 // Returns true if |child namespace| is or has |search_frame_sink_id| as a | 149 // Returns true if |child namespace| is or has |search_frame_sink_id| as a |
| 149 // child. | 150 // child. |
| 150 bool ChildContains(const FrameSinkId& child_frame_sink_id, | 151 bool ChildContains(const FrameSinkId& child_frame_sink_id, |
| 151 const FrameSinkId& search_frame_sink_id) const; | 152 const FrameSinkId& search_frame_sink_id) const; |
| 152 | 153 |
| 153 // Garbage collects all destroyed surfaces not reachable from the root. Used | 154 // Garbage collects all destroyed surfaces that aren't live. |
| 154 // when |use_references_| is true. | |
| 155 void GarbageCollectSurfacesFromRoot(); | |
| 156 void GarbageCollectSurfaces(); | 155 void GarbageCollectSurfaces(); |
| 157 | 156 |
| 158 // Removes reference from a parent surface to a child surface. Used to remove | 157 // Returns set of live surfaces for |lifetime_manager_| is REFERENCES. |
| 159 // references without triggered GC. | 158 SurfaceIdSet GetLiveSurfacesForReferences(); |
| 159 |
| 160 // Returns set of live surfaces for |lifetime_manager_| is SEQUENCES. |
| 161 SurfaceIdSet GetLiveSurfacesForSequences(); |
| 162 |
| 163 // Adds a reference from |parent_id| to |child_id| without dealing with |
| 164 // temporary references. |
| 165 void AddSurfaceReferenceImpl(const SurfaceId& parent_id, |
| 166 const SurfaceId& child_id); |
| 167 |
| 168 // Removes a reference from a |parent_id| to |child_id|. |
| 160 void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id, | 169 void RemoveSurfaceReferenceImpl(const SurfaceId& parent_id, |
| 161 const SurfaceId& child_id); | 170 const SurfaceId& child_id); |
| 162 | 171 |
| 163 // Adds a reference from parent id to child id without dealing with temporary | 172 // Removes all surface references to or from |surface_id|. Used when the |
| 164 // references. | 173 // surface is about to be deleted. |
| 165 void AddSurfaceReferenceImpl(const SurfaceId& parent_id, | 174 void RemoveAllSurfaceReferences(const SurfaceId& surface_id); |
| 166 const SurfaceId& child_id); | |
| 167 | 175 |
| 168 #if DCHECK_IS_ON() | 176 #if DCHECK_IS_ON() |
| 169 // Recursively prints surface references starting at |surface_id| to |str|. | 177 // Recursively prints surface references starting at |surface_id| to |str|. |
| 170 void SurfaceReferencesToStringImpl(const SurfaceId& surface_id, | 178 void SurfaceReferencesToStringImpl(const SurfaceId& surface_id, |
| 171 std::string indent, | 179 std::string indent, |
| 172 std::stringstream* str); | 180 std::stringstream* str); |
| 173 #endif | 181 #endif |
| 174 | 182 |
| 175 // Use reference or sequence based lifetime management. | 183 // Use reference or sequence based lifetime management. |
| 176 LifetimeType lifetime_type_; | 184 LifetimeType lifetime_type_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 temp_references_; | 251 temp_references_; |
| 244 | 252 |
| 245 base::WeakPtrFactory<SurfaceManager> weak_factory_; | 253 base::WeakPtrFactory<SurfaceManager> weak_factory_; |
| 246 | 254 |
| 247 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 255 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
| 248 }; | 256 }; |
| 249 | 257 |
| 250 } // namespace cc | 258 } // namespace cc |
| 251 | 259 |
| 252 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 260 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
| OLD | NEW |