| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <unordered_map> | 12 #include <unordered_map> |
| 13 #include <unordered_set> | 13 #include <unordered_set> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/weak_ptr.h" | |
| 19 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 20 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 21 #include "cc/surfaces/frame_sink_id.h" | 20 #include "cc/surfaces/frame_sink_id.h" |
| 22 #include "cc/surfaces/surface_id.h" | 21 #include "cc/surfaces/surface_id.h" |
| 23 #include "cc/surfaces/surface_observer.h" | 22 #include "cc/surfaces/surface_observer.h" |
| 24 #include "cc/surfaces/surface_reference_manager.h" | 23 #include "cc/surfaces/surface_reference_manager.h" |
| 25 #include "cc/surfaces/surface_sequence.h" | 24 #include "cc/surfaces/surface_sequence.h" |
| 26 #include "cc/surfaces/surfaces_export.h" | 25 #include "cc/surfaces/surfaces_export.h" |
| 27 | 26 |
| 28 namespace cc { | 27 namespace cc { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 110 |
| 112 // SurfaceReferenceManager: | 111 // SurfaceReferenceManager: |
| 113 const SurfaceId& GetRootSurfaceId() const override; | 112 const SurfaceId& GetRootSurfaceId() const override; |
| 114 void AddSurfaceReference(const SurfaceId& parent_id, | 113 void AddSurfaceReference(const SurfaceId& parent_id, |
| 115 const SurfaceId& child_id) override; | 114 const SurfaceId& child_id) override; |
| 116 void RemoveSurfaceReference(const SurfaceId& parent_id, | 115 void RemoveSurfaceReference(const SurfaceId& parent_id, |
| 117 const SurfaceId& child_id) override; | 116 const SurfaceId& child_id) override; |
| 118 size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const override; | 117 size_t GetSurfaceReferenceCount(const SurfaceId& surface_id) const override; |
| 119 size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const override; | 118 size_t GetReferencedSurfaceCount(const SurfaceId& surface_id) const override; |
| 120 | 119 |
| 121 base::WeakPtr<SurfaceManager> GetWeakPtr(); | |
| 122 | |
| 123 private: | 120 private: |
| 124 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, | 121 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 125 BeginFrameSource* source); | 122 BeginFrameSource* source); |
| 126 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, | 123 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, |
| 127 BeginFrameSource* source); | 124 BeginFrameSource* source); |
| 128 // Returns true if |child namespace| is or has |search_frame_sink_id| as a | 125 // Returns true if |child namespace| is or has |search_frame_sink_id| as a |
| 129 // child. | 126 // child. |
| 130 bool ChildContains(const FrameSinkId& child_frame_sink_id, | 127 bool ChildContains(const FrameSinkId& child_frame_sink_id, |
| 131 const FrameSinkId& search_frame_sink_id) const; | 128 const FrameSinkId& search_frame_sink_id) const; |
| 132 | 129 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 189 |
| 193 // Set of which sources are registered to which namespace. Any child | 190 // Set of which sources are registered to which namespace. Any child |
| 194 // that is implicitly using this namespace must be reachable by the | 191 // that is implicitly using this namespace must be reachable by the |
| 195 // parent in the dag. | 192 // parent in the dag. |
| 196 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; | 193 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; |
| 197 | 194 |
| 198 // Root SurfaceId that references display root surfaces. There is no Surface | 195 // Root SurfaceId that references display root surfaces. There is no Surface |
| 199 // with this id, it's for bookkeeping purposes only. | 196 // with this id, it's for bookkeeping purposes only. |
| 200 const SurfaceId root_surface_id_; | 197 const SurfaceId root_surface_id_; |
| 201 | 198 |
| 202 base::WeakPtrFactory<SurfaceManager> weak_factory_; | |
| 203 | |
| 204 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); | 199 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); |
| 205 }; | 200 }; |
| 206 | 201 |
| 207 } // namespace cc | 202 } // namespace cc |
| 208 | 203 |
| 209 #endif // CC_SURFACES_SURFACE_MANAGER_H_ | 204 #endif // CC_SURFACES_SURFACE_MANAGER_H_ |
| OLD | NEW |