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

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

Issue 2824053003: Split SurfaceFactoryClient Into Four Interfaces (Closed)
Patch Set: Address Nits Created 3 years, 8 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
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/framesink_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_FRAMESINK_MANAGER_H_ 5 #ifndef CC_SURFACES_FRAMESINK_MANAGER_H_
6 #define CC_SURFACES_FRAMESINK_MANAGER_H_ 6 #define CC_SURFACES_FRAMESINK_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <unordered_map> 10 #include <unordered_map>
11 #include <unordered_set> 11 #include <unordered_set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "cc/surfaces/frame_sink_id.h" 16 #include "cc/surfaces/frame_sink_id.h"
17 #include "cc/surfaces/surfaces_export.h" 17 #include "cc/surfaces/surfaces_export.h"
18 18
19 namespace cc { 19 namespace cc {
20 class BeginFrameSource; 20 class BeginFrameSource;
21 class SurfaceFactoryClient; 21 class FrameSinkManagerClient;
22 22
23 namespace test { 23 namespace test {
24 class CompositorFrameSinkSupportTest; 24 class CompositorFrameSinkSupportTest;
25 } 25 }
26 26
27 class CC_SURFACES_EXPORT FrameSinkManager { 27 class CC_SURFACES_EXPORT FrameSinkManager {
28 public: 28 public:
29 FrameSinkManager(); 29 FrameSinkManager();
30 ~FrameSinkManager(); 30 ~FrameSinkManager();
31 31
32 void RegisterFrameSinkId(const FrameSinkId& frame_sink_id); 32 void RegisterFrameSinkId(const FrameSinkId& frame_sink_id);
33 33
34 // Invalidate a frame_sink_id that might still have associated sequences, 34 // Invalidate a frame_sink_id that might still have associated sequences,
35 // possibly because a renderer process has crashed. 35 // possibly because a renderer process has crashed.
36 void InvalidateFrameSinkId(const FrameSinkId& frame_sink_id); 36 void InvalidateFrameSinkId(const FrameSinkId& frame_sink_id);
37 37
38 // SurfaceFactoryClient, hierarchy, and BeginFrameSource can be registered 38 // SurfaceFactoryClient, hierarchy, and BeginFrameSource can be registered
39 // and unregistered in any order with respect to each other. 39 // and unregistered in any order with respect to each other.
40 // 40 //
41 // This happens in practice, e.g. the relationship to between ui::Compositor / 41 // This happens in practice, e.g. the relationship to between ui::Compositor /
42 // DelegatedFrameHost is known before ui::Compositor has a surface/client). 42 // DelegatedFrameHost is known before ui::Compositor has a surface/client).
43 // However, DelegatedFrameHost can register itself as a client before its 43 // However, DelegatedFrameHost can register itself as a client before its
44 // relationship with the ui::Compositor is known. 44 // relationship with the ui::Compositor is known.
45 45
46 // Associates a SurfaceFactoryClient with the frame_sink_id it uses. 46 // Associates a FrameSinkManagerClient with the frame_sink_id it uses.
47 // SurfaceFactoryClient and framesink allocators have a 1:1 mapping. 47 // FrameSinkManagerClient and framesink allocators have a 1:1 mapping.
48 // Caller guarantees the client is alive between register/unregister. 48 // Caller guarantees the client is alive between register/unregister.
49 void RegisterSurfaceFactoryClient(const FrameSinkId& frame_sink_id, 49 void RegisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id,
50 SurfaceFactoryClient* client); 50 FrameSinkManagerClient* client);
51 void UnregisterSurfaceFactoryClient(const FrameSinkId& frame_sink_id); 51 void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id);
52 52
53 // Associates a |source| with a particular framesink. That framesink and 53 // Associates a |source| with a particular framesink. That framesink and
54 // any children of that framesink with valid clients can potentially use 54 // any children of that framesink with valid clients can potentially use
55 // that |source|. 55 // that |source|.
56 void RegisterBeginFrameSource(BeginFrameSource* source, 56 void RegisterBeginFrameSource(BeginFrameSource* source,
57 const FrameSinkId& frame_sink_id); 57 const FrameSinkId& frame_sink_id);
58 void UnregisterBeginFrameSource(BeginFrameSource* source); 58 void UnregisterBeginFrameSource(BeginFrameSource* source);
59 59
60 // Register a relationship between two framesinks. This relationship means 60 // Register a relationship between two framesinks. This relationship means
61 // that surfaces from the child framesik will be displayed in the parent. 61 // that surfaces from the child framesik will be displayed in the parent.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 FrameSinkSourceMapping(); 96 FrameSinkSourceMapping();
97 FrameSinkSourceMapping(const FrameSinkSourceMapping& other); 97 FrameSinkSourceMapping(const FrameSinkSourceMapping& other);
98 ~FrameSinkSourceMapping(); 98 ~FrameSinkSourceMapping();
99 bool has_children() const { return !children.empty(); } 99 bool has_children() const { return !children.empty(); }
100 // The currently assigned begin frame source for this client. 100 // The currently assigned begin frame source for this client.
101 BeginFrameSource* source; 101 BeginFrameSource* source;
102 // This represents a dag of parent -> children mapping. 102 // This represents a dag of parent -> children mapping.
103 std::vector<FrameSinkId> children; 103 std::vector<FrameSinkId> children;
104 }; 104 };
105 105
106 std::unordered_map<FrameSinkId, SurfaceFactoryClient*, FrameSinkIdHash> 106 std::unordered_map<FrameSinkId, FrameSinkManagerClient*, FrameSinkIdHash>
107 clients_; 107 clients_;
108 108
109 std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash> 109 std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash>
110 frame_sink_source_map_; 110 frame_sink_source_map_;
111 111
112 // Set of which sources are registered to which frmesinks. Any child 112 // Set of which sources are registered to which frmesinks. Any child
113 // that is implicitly using this framesink must be reachable by the 113 // that is implicitly using this framesink must be reachable by the
114 // parent in the dag. 114 // parent in the dag.
115 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; 115 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(FrameSinkManager); 117 DISALLOW_COPY_AND_ASSIGN(FrameSinkManager);
118 }; 118 };
119 119
120 } // namespace cc 120 } // namespace cc
121 121
122 #endif // CC_SURFACES_FRAMESINK_MANAGER_H_ 122 #endif // CC_SURFACES_FRAMESINK_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.cc ('k') | cc/surfaces/framesink_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698