| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // Register a relationship between two namespaces. This relationship means | 97 // Register a relationship between two namespaces. This relationship means |
| 98 // that surfaces from the child namespace will be displayed in the parent. | 98 // that surfaces from the child namespace will be displayed in the parent. |
| 99 // Children are allowed to use any begin frame source that their parent can | 99 // Children are allowed to use any begin frame source that their parent can |
| 100 // use. | 100 // use. |
| 101 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, | 101 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, |
| 102 const FrameSinkId& child_frame_sink_id); | 102 const FrameSinkId& child_frame_sink_id); |
| 103 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, | 103 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, |
| 104 const FrameSinkId& child_frame_sink_id); | 104 const FrameSinkId& child_frame_sink_id); |
| 105 | 105 |
| 106 void PrintReferenceTree(const std::string& name); |
| 107 |
| 106 // SurfaceReferenceManager: | 108 // SurfaceReferenceManager: |
| 107 const SurfaceId& GetRootSurfaceId() const override; | 109 const SurfaceId& GetRootSurfaceId() const override; |
| 108 void AddSurfaceReference(const SurfaceId& parent_id, | 110 void AddSurfaceReference(const SurfaceId& parent_id, |
| 109 const SurfaceId& child_id) override; | 111 const SurfaceId& child_id) override; |
| 110 void RemoveSurfaceReference(const SurfaceId& parent_id, | 112 void RemoveSurfaceReference(const SurfaceId& parent_id, |
| 111 const SurfaceId& child_id) override; | 113 const SurfaceId& child_id) override; |
| 112 size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const override; | 114 size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const override; |
| 113 size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const override; | 115 size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const override; |
| 114 | 116 |
| 115 private: | 117 private: |
| 118 void PrintReferenceTreeImpl(const SurfaceId& surface_id, |
| 119 std::string indent, |
| 120 std::string* str); |
| 121 |
| 116 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, | 122 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 117 BeginFrameSource* source); | 123 BeginFrameSource* source); |
| 118 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, | 124 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 119 BeginFrameSource* source); | 125 BeginFrameSource* source); |
| 120 // Returns true if |child namespace| is or has |search_frame_sink_id| as a | 126 // Returns true if |child namespace| is or has |search_frame_sink_id| as a |
| 121 // child. | 127 // child. |
| 122 bool ChildContains(const FrameSinkId& child_frame_sink_id, | 128 bool ChildContains(const FrameSinkId& child_frame_sink_id, |
| 123 const FrameSinkId& search_frame_sink_id) const; | 129 const FrameSinkId& search_frame_sink_id) const; |
| 124 | 130 |
| 125 void GarbageCollectSurfaces(); | 131 void GarbageCollectSurfaces(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 std::unordered_map<SurfaceId, SurfaceIdSet, SurfaceIdHash> | 182 std::unordered_map<SurfaceId, SurfaceIdSet, SurfaceIdHash> |
| 177 parent_to_child_refs_; | 183 parent_to_child_refs_; |
| 178 | 184 |
| 179 // Set of which sources are registered to which namespace. Any child | 185 // Set of which sources are registered to which namespace. Any child |
| 180 // that is implicitly using this namespace must be reachable by the | 186 // that is implicitly using this namespace must be reachable by the |
| 181 // parent in the dag. | 187 // parent in the dag. |
| 182 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; | 188 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; |
| 183 | 189 |
| 184 // Root SurfaceId that references display root surfaces. There is no Surface | 190 // Root SurfaceId that references display root surfaces. There is no Surface |
| 185 // with this id, it's for bookkeeping purposes only. | 191 // with this id, it's for bookkeeping purposes only. |
| 186 const SurfaceId kRootSurfaceId; | 192 const SurfaceId root_surface_id_; |
| 187 | 193 |
| 188 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 194 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
| 189 }; | 195 }; |
| 190 | 196 |
| 191 } // namespace cc | 197 } // namespace cc |
| 192 | 198 |
| 193 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 199 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
| OLD | NEW |