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

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

Issue 1496103002: Reusing base::IdType<...> to implement SurfaceId. Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-id-base
Patch Set: Rebasing + dusting off... Created 4 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
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/surface_aggregator_perftest.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_SURFACE_AGGREGATOR_H_ 5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_
6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_
7 7
8 #include <set> 8 #include <set>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 18 matching lines...) Expand all
29 class CC_SURFACES_EXPORT SurfaceAggregatorClient { 29 class CC_SURFACES_EXPORT SurfaceAggregatorClient {
30 public: 30 public:
31 virtual ~SurfaceAggregatorClient() {} 31 virtual ~SurfaceAggregatorClient() {}
32 32
33 virtual void AddSurface(Surface* surface) = 0; 33 virtual void AddSurface(Surface* surface) = 0;
34 virtual void RemoveSurface(Surface* surface) = 0; 34 virtual void RemoveSurface(Surface* surface) = 0;
35 }; 35 };
36 36
37 class CC_SURFACES_EXPORT SurfaceAggregator { 37 class CC_SURFACES_EXPORT SurfaceAggregator {
38 public: 38 public:
39 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>; 39 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceId::Hasher>;
40 40
41 SurfaceAggregator(SurfaceAggregatorClient* client, 41 SurfaceAggregator(SurfaceAggregatorClient* client,
42 SurfaceManager* manager, 42 SurfaceManager* manager,
43 ResourceProvider* provider, 43 ResourceProvider* provider,
44 bool aggregate_only_damaged); 44 bool aggregate_only_damaged);
45 ~SurfaceAggregator(); 45 ~SurfaceAggregator();
46 46
47 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); 47 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id);
48 void ReleaseResources(SurfaceId surface_id); 48 void ReleaseResources(SurfaceId surface_id);
49 SurfaceIndexMap& previous_contained_surfaces() { 49 SurfaceIndexMap& previous_contained_surfaces() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const gfx::Rect& full_rect) const; 109 const gfx::Rect& full_rect) const;
110 110
111 SurfaceAggregatorClient* client_; // Outlives this class. 111 SurfaceAggregatorClient* client_; // Outlives this class.
112 SurfaceManager* manager_; 112 SurfaceManager* manager_;
113 ResourceProvider* provider_; 113 ResourceProvider* provider_;
114 114
115 class RenderPassIdAllocator; 115 class RenderPassIdAllocator;
116 using RenderPassIdAllocatorMap = 116 using RenderPassIdAllocatorMap =
117 std::unordered_map<SurfaceId, 117 std::unordered_map<SurfaceId,
118 scoped_ptr<RenderPassIdAllocator>, 118 scoped_ptr<RenderPassIdAllocator>,
119 SurfaceIdHash>; 119 SurfaceId::Hasher>;
120 RenderPassIdAllocatorMap render_pass_allocator_map_; 120 RenderPassIdAllocatorMap render_pass_allocator_map_;
121 int next_render_pass_id_; 121 int next_render_pass_id_;
122 const bool aggregate_only_damaged_; 122 const bool aggregate_only_damaged_;
123 123
124 using SurfaceToResourceChildIdMap = 124 using SurfaceToResourceChildIdMap =
125 std::unordered_map<SurfaceId, int, SurfaceIdHash>; 125 std::unordered_map<SurfaceId, int, SurfaceId::Hasher>;
126 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; 126 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_;
127 127
128 // The following state is only valid for the duration of one Aggregate call 128 // The following state is only valid for the duration of one Aggregate call
129 // and is only stored on the class to avoid having to pass through every 129 // and is only stored on the class to avoid having to pass through every
130 // function call. 130 // function call.
131 131
132 // This is the set of surfaces referenced in the aggregation so far, used to 132 // This is the set of surfaces referenced in the aggregation so far, used to
133 // detect cycles. 133 // detect cycles.
134 using SurfaceSet = std::set<SurfaceId>; 134 using SurfaceSet = std::set<SurfaceId>;
135 SurfaceSet referenced_surfaces_; 135 SurfaceSet referenced_surfaces_;
136 136
137 // For each Surface used in the last aggregation, gives the frame_index at 137 // For each Surface used in the last aggregation, gives the frame_index at
138 // that time. 138 // that time.
139 SurfaceIndexMap previous_contained_surfaces_; 139 SurfaceIndexMap previous_contained_surfaces_;
140 SurfaceIndexMap contained_surfaces_; 140 SurfaceIndexMap contained_surfaces_;
141 141
142 // After surface validation, every Surface in this set is valid. 142 // After surface validation, every Surface in this set is valid.
143 std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_; 143 std::unordered_set<SurfaceId, SurfaceId::Hasher> valid_surfaces_;
144 144
145 // This is the pass list for the aggregated frame. 145 // This is the pass list for the aggregated frame.
146 RenderPassList* dest_pass_list_; 146 RenderPassList* dest_pass_list_;
147 147
148 // The root damage rect of the currently-aggregating frame. 148 // The root damage rect of the currently-aggregating frame.
149 gfx::Rect root_damage_rect_; 149 gfx::Rect root_damage_rect_;
150 150
151 // True if the frame that's currently being aggregated has copy requests. 151 // True if the frame that's currently being aggregated has copy requests.
152 // This is valid during Aggregate after PrewalkTree is called. 152 // This is valid during Aggregate after PrewalkTree is called.
153 bool has_copy_requests_; 153 bool has_copy_requests_;
154 154
155 // Resource list for the aggregated frame. 155 // Resource list for the aggregated frame.
156 TransferableResourceArray* dest_resource_list_; 156 TransferableResourceArray* dest_resource_list_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); 158 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator);
159 }; 159 };
160 160
161 } // namespace cc 161 } // namespace cc
162 162
163 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ 163 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/surface_aggregator_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698