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