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

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

Issue 2908473002: Revert of cc::SurfaceDependencyTracker should not crash when a Display goes away (Closed)
Patch Set: Created 3 years, 7 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/BUILD.gn ('k') | cc/surfaces/frame_sink_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_FRAME_SINK_MANAGER_H_ 5 #ifndef CC_SURFACES_FRAME_SINK_MANAGER_H_
6 #define CC_SURFACES_FRAME_SINK_MANAGER_H_ 6 #define CC_SURFACES_FRAME_SINK_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/primary_begin_frame_source.h"
18 #include "cc/surfaces/surfaces_export.h" 17 #include "cc/surfaces/surfaces_export.h"
19 18
20 namespace cc { 19 namespace cc {
21 class BeginFrameSource; 20 class BeginFrameSource;
22 class FrameSinkManagerClient; 21 class FrameSinkManagerClient;
23 22
24 namespace test { 23 namespace test {
25 class SurfaceSynchronizationTest; 24 class SurfaceSynchronizationTest;
26 } 25 }
27 26
(...skipping 23 matching lines...) Expand all
51 FrameSinkManagerClient* client); 50 FrameSinkManagerClient* client);
52 void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id); 51 void UnregisterFrameSinkManagerClient(const FrameSinkId& frame_sink_id);
53 52
54 // Associates a |source| with a particular framesink. That framesink and 53 // Associates a |source| with a particular framesink. That framesink and
55 // any children of that framesink with valid clients can potentially use 54 // any children of that framesink with valid clients can potentially use
56 // that |source|. 55 // that |source|.
57 void RegisterBeginFrameSource(BeginFrameSource* source, 56 void RegisterBeginFrameSource(BeginFrameSource* source,
58 const FrameSinkId& frame_sink_id); 57 const FrameSinkId& frame_sink_id);
59 void UnregisterBeginFrameSource(BeginFrameSource* source); 58 void UnregisterBeginFrameSource(BeginFrameSource* source);
60 59
61 // Returns a stable BeginFrameSource that forwards BeginFrames from the first
62 // available BeginFrameSource.
63 BeginFrameSource* GetPrimaryBeginFrameSource();
64
65 // Register a relationship between two framesinks. This relationship means 60 // Register a relationship between two framesinks. This relationship means
66 // 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.
67 // Children are allowed to use any begin frame source that their parent can 62 // Children are allowed to use any begin frame source that their parent can
68 // use. 63 // use.
69 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, 64 void RegisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id,
70 const FrameSinkId& child_frame_sink_id); 65 const FrameSinkId& child_frame_sink_id);
71 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id, 66 void UnregisterFrameSinkHierarchy(const FrameSinkId& parent_frame_sink_id,
72 const FrameSinkId& child_frame_sink_id); 67 const FrameSinkId& child_frame_sink_id);
73 68
74 // Export list of valid frame_sink_ids for SatisfyDestructionDeps in surface 69 // Export list of valid frame_sink_ids for SatisfyDestructionDeps in surface
(...skipping 22 matching lines...) Expand all
97 92
98 // Begin frame source routing. Both BeginFrameSource and 93 // Begin frame source routing. Both BeginFrameSource and
99 // CompositorFrameSinkSupport pointers guaranteed alive by callers until 94 // CompositorFrameSinkSupport pointers guaranteed alive by callers until
100 // unregistered. 95 // unregistered.
101 struct FrameSinkSourceMapping { 96 struct FrameSinkSourceMapping {
102 FrameSinkSourceMapping(); 97 FrameSinkSourceMapping();
103 FrameSinkSourceMapping(const FrameSinkSourceMapping& other); 98 FrameSinkSourceMapping(const FrameSinkSourceMapping& other);
104 ~FrameSinkSourceMapping(); 99 ~FrameSinkSourceMapping();
105 bool has_children() const { return !children.empty(); } 100 bool has_children() const { return !children.empty(); }
106 // The currently assigned begin frame source for this client. 101 // The currently assigned begin frame source for this client.
107 BeginFrameSource* source = nullptr; 102 BeginFrameSource* source;
108 // This represents a dag of parent -> children mapping. 103 // This represents a dag of parent -> children mapping.
109 std::vector<FrameSinkId> children; 104 std::vector<FrameSinkId> children;
110 }; 105 };
111 106
112 std::unordered_map<FrameSinkId, FrameSinkManagerClient*, FrameSinkIdHash> 107 std::unordered_map<FrameSinkId, FrameSinkManagerClient*, FrameSinkIdHash>
113 clients_; 108 clients_;
114 109
115 std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash> 110 std::unordered_map<FrameSinkId, FrameSinkSourceMapping, FrameSinkIdHash>
116 frame_sink_source_map_; 111 frame_sink_source_map_;
117 112
118 // Set of BeginFrameSource along with associated FrameSinkIds. Any child 113 // Set of which sources are registered to which frmesinks. Any child
119 // that is implicitly using this framesink must be reachable by the 114 // that is implicitly using this framesink must be reachable by the
120 // parent in the dag. 115 // parent in the dag.
121 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_; 116 std::unordered_map<BeginFrameSource*, FrameSinkId> registered_sources_;
122 117
123 PrimaryBeginFrameSource primary_source_;
124
125 DISALLOW_COPY_AND_ASSIGN(FrameSinkManager); 118 DISALLOW_COPY_AND_ASSIGN(FrameSinkManager);
126 }; 119 };
127 120
128 } // namespace cc 121 } // namespace cc
129 122
130 #endif // CC_SURFACES_FRAME_SINK_MANAGER_H_ 123 #endif // CC_SURFACES_FRAME_SINK_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/frame_sink_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698