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

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

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. 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/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "base/threading/thread_checker.h" 21 #include "base/threading/thread_checker.h"
22 #include "cc/surfaces/display_compositor_lock_manager.h"
22 #include "cc/surfaces/frame_sink_id.h" 23 #include "cc/surfaces/frame_sink_id.h"
23 #include "cc/surfaces/surface_id.h" 24 #include "cc/surfaces/surface_id.h"
24 #include "cc/surfaces/surface_observer.h" 25 #include "cc/surfaces/surface_observer.h"
25 #include "cc/surfaces/surface_reference_factory.h" 26 #include "cc/surfaces/surface_reference_factory.h"
26 #include "cc/surfaces/surface_reference_manager.h" 27 #include "cc/surfaces/surface_reference_manager.h"
27 #include "cc/surfaces/surface_sequence.h" 28 #include "cc/surfaces/surface_sequence.h"
28 #include "cc/surfaces/surfaces_export.h" 29 #include "cc/surfaces/surfaces_export.h"
29 30
30 #if DCHECK_IS_ON() 31 #if DCHECK_IS_ON()
31 #include <iosfwd> 32 #include <iosfwd>
(...skipping 15 matching lines...) Expand all
47 }; 48 };
48 49
49 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES); 50 explicit SurfaceManager(LifetimeType lifetime_type = LifetimeType::SEQUENCES);
50 ~SurfaceManager() override; 51 ~SurfaceManager() override;
51 52
52 #if DCHECK_IS_ON() 53 #if DCHECK_IS_ON()
53 // Returns a string representation of all reachable surface references. 54 // Returns a string representation of all reachable surface references.
54 std::string SurfaceReferencesToString(); 55 std::string SurfaceReferencesToString();
55 #endif 56 #endif
56 57
58 void SetLockManager(
59 std::unique_ptr<DisplayCompositorLockManager> lock_manager);
60 DisplayCompositorLockManager* lock_manager() { return lock_manager_.get(); }
61
62 void RequestSurfaceResolution(Surface* pending_surface);
63
57 void RegisterSurface(Surface* surface); 64 void RegisterSurface(Surface* surface);
58 void DeregisterSurface(const SurfaceId& surface_id); 65 void DeregisterSurface(const SurfaceId& surface_id);
59 66
60 // 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.
61 void Destroy(std::unique_ptr<Surface> surface); 68 void Destroy(std::unique_ptr<Surface> surface);
62 69
63 Surface* GetSurfaceForId(const SurfaceId& surface_id); 70 Surface* GetSurfaceForId(const SurfaceId& surface_id);
64 71
65 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); } 72 void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); }
66 73
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 scoped_refptr<SurfaceReferenceFactory> reference_factory_; 242 scoped_refptr<SurfaceReferenceFactory> reference_factory_;
236 243
237 // SurfaceIds that have temporary references from top level root so they 244 // SurfaceIds that have temporary references from top level root so they
238 // aren't GC'd before a real reference is added. This is basically a 245 // aren't GC'd before a real reference is added. This is basically a
239 // collection of surface ids, for example: 246 // collection of surface ids, for example:
240 // SurfaceId surface_id(key, value[index]); 247 // SurfaceId surface_id(key, value[index]);
241 // The LocalFrameIds are stored in the order the surfaces are created in. 248 // The LocalFrameIds are stored in the order the surfaces are created in.
242 std::unordered_map<FrameSinkId, std::vector<LocalFrameId>, FrameSinkIdHash> 249 std::unordered_map<FrameSinkId, std::vector<LocalFrameId>, FrameSinkIdHash>
243 temp_references_; 250 temp_references_;
244 251
252 std::unique_ptr<DisplayCompositorLockManager> lock_manager_;
253
245 base::WeakPtrFactory<SurfaceManager> weak_factory_; 254 base::WeakPtrFactory<SurfaceManager> weak_factory_;
246 255
247 DISALLOW_COPY_AND_ASSIGN(SurfaceManager); 256 DISALLOW_COPY_AND_ASSIGN(SurfaceManager);
248 }; 257 };
249 258
250 } // namespace cc 259 } // namespace cc
251 260
252 #endif // CC_SURFACES_SURFACE_MANAGER_H_ 261 #endif // CC_SURFACES_SURFACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698