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

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

Issue 2676373004: Implement service-side surface synchronization (Closed)
Patch Set: Better unit test name Created 3 years, 10 months 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/logging.h" 16 #include "base/logging.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_dependency_tracker.h"
22 #include "cc/surfaces/surface_id.h" 23 #include "cc/surfaces/surface_id.h"
23 #include "cc/surfaces/surface_observer.h" 24 #include "cc/surfaces/surface_observer.h"
24 #include "cc/surfaces/surface_reference.h" 25 #include "cc/surfaces/surface_reference.h"
25 #include "cc/surfaces/surface_reference_factory.h" 26 #include "cc/surfaces/surface_reference_factory.h"
26 #include "cc/surfaces/surface_sequence.h" 27 #include "cc/surfaces/surface_sequence.h"
27 #include "cc/surfaces/surfaces_export.h" 28 #include "cc/surfaces/surfaces_export.h"
28 29
29 #if DCHECK_IS_ON() 30 #if DCHECK_IS_ON()
30 #include <iosfwd> 31 #include <iosfwd>
31 #include <string> 32 #include <string>
(...skipping 13 matching lines...) Expand all
45 }; 46 };
46 47
47 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); 48 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES);
48 ~SurfaceManager(); 49 ~SurfaceManager();
49 50
50 #if DCHECK_IS_ON() 51 #if DCHECK_IS_ON()
51 // Returns a string representation of all reachable surface references. 52 // Returns a string representation of all reachable surface references.
52 std::string SurfaceReferencesToString(); 53 std::string SurfaceReferencesToString();
53 #endif 54 #endif
54 55
56 void SetDependencyTracker(
57 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker);
58 SurfaceDependencyTracker* dependency_tracker() {
59 return dependency_tracker_.get();
60 }
61
62 void RequestSurfaceResolution(Surface* pending_surface);
63
55 void RegisterSurface(Surface* surface); 64 void RegisterSurface(Surface* surface);
56 void DeregisterSurface(const SurfaceId& surface_id); 65 void DeregisterSurface(const SurfaceId& surface_id);
57 66
58 // Destroy the Surface once a set of sequence numbers has been satisfied. 67 // Destroy the Surface once a set of sequence numbers has been satisfied.
59 void Destroy(std::unique_ptr<Surface> surface); 68 void Destroy(std::unique_ptr<Surface> surface);
60 69
61 Surface* GetSurfaceForId(const SurfaceId& surface_id); 70 Surface* GetSurfaceForId(const SurfaceId& surface_id);
62 71
63 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } 72 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); }
64 73
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 scoped_refptr<SurfaceReferenceFactory> reference_factory_; 263 scoped_refptr<SurfaceReferenceFactory> reference_factory_;
255 264
256 // SurfaceIds that have temporary references from top level root so they 265 // SurfaceIds that have temporary references from top level root so they
257 // aren't GC'd before a real reference is added. This is basically a 266 // aren't GC'd before a real reference is added. This is basically a
258 // collection of surface ids, for example: 267 // collection of surface ids, for example:
259 // SurfaceId surface_id(key, value[index]); 268 // SurfaceId surface_id(key, value[index]);
260 // The LocalSurfaceIds are stored in the order the surfaces are created in. 269 // The LocalSurfaceIds are stored in the order the surfaces are created in.
261 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash> 270 std::unordered_map<FrameSinkId, std::vector<LocalSurfaceId>, FrameSinkIdHash>
262 temp_references_; 271 temp_references_;
263 272
273 std::unique_ptr<SurfaceDependencyTracker> dependency_tracker_;
274
264 base::WeakPtrFactory<SurfaceManager> weak_factory_; 275 base::WeakPtrFactory<SurfaceManager> weak_factory_;
265 276
266 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); 277 DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
267 }; 278 };
268 279
269 } // namespace cc 280 } // namespace cc
270 281
271 #endif // CC_SURFACES_SURFACE_MANAGER_H_ 282 #endif // CC_SURFACES_SURFACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698