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

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

Issue 2379653006: Replaced cc::SurfaceId::nonce_ with base::UnguessableToken (Closed)
Patch Set: Changed SurfaceManager::kRootSurfaceId to a private field to avoid static initialization Created 4 years, 1 month 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
« no previous file with comments | « cc/surfaces/surface_id_allocator.cc ('k') | cc/surfaces/surface_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 12 matching lines...) Expand all
23 #include "cc/surfaces/surfaces_export.h" 23 #include "cc/surfaces/surfaces_export.h"
24 24
25 namespace cc { 25 namespace cc {
26 class BeginFrameSource; 26 class BeginFrameSource;
27 class CompositorFrame; 27 class CompositorFrame;
28 class Surface; 28 class Surface;
29 class SurfaceFactoryClient; 29 class SurfaceFactoryClient;
30 30
31 class CC_SURFACES_EXPORT SurfaceManager { 31 class CC_SURFACES_EXPORT SurfaceManager {
32 public: 32 public:
33 // Root SurfaceId that references display root surfaces. There is no Surface
34 // with this id, it's for bookkeeping purposes only.
35 static const SurfaceId kRootSurfaceId;
36
37 SurfaceManager(); 33 SurfaceManager();
38 ~SurfaceManager(); 34 ~SurfaceManager();
39 35
40 void RegisterSurface(Surface* surface); 36 void RegisterSurface(Surface* surface);
41 void DeregisterSurface(const SurfaceId& surface_id); 37 void DeregisterSurface(const SurfaceId& surface_id);
42 38
43 // Destroy the Surface once a set of sequence numbers has been satisfied. 39 // Destroy the Surface once a set of sequence numbers has been satisfied.
44 void Destroy(std::unique_ptr<Surface> surface); 40 void Destroy(std::unique_ptr<Surface> surface);
45 41
46 Surface* GetSurfaceForId(const SurfaceId& surface_id); 42 Surface* GetSurfaceForId(const SurfaceId& surface_id);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 111
116 // Register a relationship between two namespaces. This relationship means 112 // Register a relationship between two namespaces. This relationship means
117 // that surfaces from the child namespace will be displayed in the parent. 113 // that surfaces from the child namespace will be displayed in the parent.
118 // Children are allowed to use any begin frame source that their parent can 114 // Children are allowed to use any begin frame source that their parent can
119 // use. 115 // use.
120 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, 116 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id,
121 const FrameSinkId& child_frame_sink_id); 117 const FrameSinkId& child_frame_sink_id);
122 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, 118 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id,
123 const FrameSinkId& child_frame_sink_id); 119 const FrameSinkId& child_frame_sink_id);
124 120
121 const SurfaceId& GetRootSurfaceId() { return kRootSurfaceId; }
122
125 private: 123 private:
126 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id, 124 void RecursivelyAttachBeginFrameSource(const FrameSinkId& frame_sink_id,
127 BeginFrameSource* source); 125 BeginFrameSource* source);
128 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id, 126 void RecursivelyDetachBeginFrameSource(const FrameSinkId& frame_sink_id,
129 BeginFrameSource* source); 127 BeginFrameSource* source);
130 // 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
131 // child. 129 // child.
132 bool ChildContains(const FrameSinkId& child_frame_sink_id, 130 bool ChildContains(const FrameSinkId& child_frame_sink_id,
133 const FrameSinkId& search_frame_sink_id) const; 131 const FrameSinkId& search_frame_sink_id) const;
134 132
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Tracks references from the parent surface to child surface. Is the inverse 182 // Tracks references from the parent surface to child surface. Is the inverse
185 // of |child_to_parent_refs_|. 183 // of |child_to_parent_refs_|.
186 std::unordered_map<SurfaceId, SurfaceIdSet, SurfaceIdHash> 184 std::unordered_map<SurfaceId, SurfaceIdSet, SurfaceIdHash>
187 parent_to_child_refs_; 185 parent_to_child_refs_;
188 186
189 // Set of which sources are registered to which namespace. Any child 187 // Set of which sources are registered to which namespace. Any child
190 // that is implicitly using this namespace must be reachable by the 188 // that is implicitly using this namespace must be reachable by the
191 // parent in the dag. 189 // parent in the dag.
192 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; 190 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_;
193 191
192 // Root SurfaceId that references display root surfaces. There is no Surface
193 // with this id, it's for bookkeeping purposes only.
194 const SurfaceId kRootSurfaceId;
195
194 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); 196 DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
195 }; 197 };
196 198
197 } // namespace cc 199 } // namespace cc
198 200
199 #endif // CC_SURFACES_SURFACE_MANAGER_H_ 201 #endif // CC_SURFACES_SURFACE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_id_allocator.cc ('k') | cc/surfaces/surface_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698