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