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

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

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