Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: cc/surfaces/surface_manager.h

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: c Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "cc/surfaces/direct_surface_reference_factory.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 {
28 class BeginFrameSource; 29 class BeginFrameSource;
29 class CompositorFrame; 30 class CompositorFrame;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 scoped_refptr<SurfaceReferenceFactory> reference_factory() {
122 return reference_factory_;
123 }
124
120 private: 125 private:
121 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, 126 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id,
122 BeginFrameSource* source); 127 BeginFrameSource* source);
123 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, 128 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id,
124 BeginFrameSource* source); 129 BeginFrameSource* source);
125 // Returns true if |child namespace| is or has |search_frame_sink_id| as a 130 // Returns true if |child namespace| is or has |search_frame_sink_id| as a
126 // child. 131 // child.
127 bool ChildContains(const FrameSinkId& child_frame_sink_id, 132 bool ChildContains(const FrameSinkId& child_frame_sink_id,
128 const FrameSinkId& search_frame_sink_id) const; 133 const FrameSinkId& search_frame_sink_id) const;
129 134
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 194
190 // Set of which sources are registered to which namespace. Any child 195 // Set of which sources are registered to which namespace. Any child
191 // that is implicitly using this namespace must be reachable by the 196 // that is implicitly using this namespace must be reachable by the
192 // parent in the dag. 197 // parent in the dag.
193 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; 198 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_;
194 199
195 // Root SurfaceId that references display root surfaces. There is no Surface 200 // Root SurfaceId that references display root surfaces. There is no Surface
196 // with this id, it's for bookkeeping purposes only. 201 // with this id, it's for bookkeeping purposes only.
197 const SurfaceId root_surface_id_; 202 const SurfaceId root_surface_id_;
198 203
204 // The DirectSurfaceReferenceFactory that uses this manager to create surface
205 // references.
206 scoped_refptr<SurfaceReferenceFactory> reference_factory_;
207
199 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); 208 DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
200 }; 209 };
201 210
202 } // namespace cc 211 } // namespace cc
203 212
204 #endif // CC_SURFACES_SURFACE_MANAGER_H_ 213 #endif // CC_SURFACES_SURFACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698