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