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

Side by Side Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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 #include "cc/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 21 matching lines...) Expand all
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 #include "third_party/skia/include/core/SkColor.h" 33 #include "third_party/skia/include/core/SkColor.h"
34 34
35 namespace cc { 35 namespace cc {
36 namespace { 36 namespace {
37 37
38 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); 38 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
39 static constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2); 39 static constexpr FrameSinkId kArbitraryChildFrameSinkId(2, 2);
40 40
41 SurfaceId InvalidSurfaceId() { 41 SurfaceId InvalidSurfaceId() {
42 static SurfaceId invalid(kArbitraryFrameSinkId, 0xdeadbeef, 0); 42 static SurfaceId invalid(kArbitraryFrameSinkId, LocalFrameId(0xdeadbeef, 0));
43 return invalid; 43 return invalid;
44 } 44 }
45 45
46 gfx::Size SurfaceSize() { 46 gfx::Size SurfaceSize() {
47 static gfx::Size size(100, 100); 47 static gfx::Size size(100, 100);
48 return size; 48 return size;
49 } 49 }
50 50
51 class EmptySurfaceFactoryClient : public SurfaceFactoryClient { 51 class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
52 public: 52 public:
53 void ReturnResources(const ReturnedResourceArray& resources) override {} 53 void ReturnResources(const ReturnedResourceArray& resources) override {}
54 54
55 void WillDrawSurface(const SurfaceId& id, 55 void WillDrawSurface(const LocalFrameId& id,
56 const gfx::Rect& damage_rect) override { 56 const gfx::Rect& damage_rect) override {
57 last_surface_id_ = id; 57 last_local_frame_id_ = id;
58 last_damage_rect_ = damage_rect; 58 last_damage_rect_ = damage_rect;
59 } 59 }
60 60
61 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {} 61 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
62 62
63 gfx::Rect last_damage_rect_; 63 gfx::Rect last_damage_rect_;
64 SurfaceId last_surface_id_; 64 LocalFrameId last_local_frame_id_;
65 }; 65 };
66 66
67 class SurfaceAggregatorTest : public testing::Test { 67 class SurfaceAggregatorTest : public testing::Test {
68 public: 68 public:
69 explicit SurfaceAggregatorTest(bool use_damage_rect) 69 explicit SurfaceAggregatorTest(bool use_damage_rect)
70 : factory_(kArbitraryFrameSinkId, &manager_, &empty_client_), 70 : factory_(kArbitraryFrameSinkId, &manager_, &empty_client_),
71 aggregator_(&manager_, NULL, use_damage_rect) {} 71 aggregator_(&manager_, NULL, use_damage_rect) {}
72 72
73 SurfaceAggregatorTest() : SurfaceAggregatorTest(false) {} 73 SurfaceAggregatorTest() : SurfaceAggregatorTest(false) {}
74 74
75 protected: 75 protected:
76 SurfaceManager manager_; 76 SurfaceManager manager_;
77 EmptySurfaceFactoryClient empty_client_; 77 EmptySurfaceFactoryClient empty_client_;
78 SurfaceFactory factory_; 78 SurfaceFactory factory_;
79 SurfaceAggregator aggregator_; 79 SurfaceAggregator aggregator_;
80 }; 80 };
81 81
82 TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) { 82 TEST_F(SurfaceAggregatorTest, ValidSurfaceNoFrame) {
83 SurfaceId one_id(kArbitraryFrameSinkId, 7, 0); 83 LocalFrameId local_frame_id(7, 0);
84 factory_.Create(one_id); 84 SurfaceId one_id(kArbitraryFrameSinkId, local_frame_id);
85 factory_.Create(local_frame_id);
85 86
86 CompositorFrame frame = aggregator_.Aggregate(one_id); 87 CompositorFrame frame = aggregator_.Aggregate(one_id);
87 EXPECT_FALSE(frame.delegated_frame_data); 88 EXPECT_FALSE(frame.delegated_frame_data);
88 89
89 factory_.Destroy(one_id); 90 factory_.Destroy(local_frame_id);
90 } 91 }
91 92
92 class SurfaceAggregatorValidSurfaceTest : public SurfaceAggregatorTest { 93 class SurfaceAggregatorValidSurfaceTest : public SurfaceAggregatorTest {
93 public: 94 public:
94 explicit SurfaceAggregatorValidSurfaceTest(bool use_damage_rect) 95 explicit SurfaceAggregatorValidSurfaceTest(bool use_damage_rect)
95 : SurfaceAggregatorTest(use_damage_rect), 96 : SurfaceAggregatorTest(use_damage_rect),
96 allocator_(kArbitraryFrameSinkId),
97 child_factory_(kArbitraryChildFrameSinkId, 97 child_factory_(kArbitraryChildFrameSinkId,
98 &manager_, 98 &manager_,
99 &empty_child_client_), 99 &empty_child_client_) {}
100 child_allocator_(kArbitraryChildFrameSinkId) {}
101 SurfaceAggregatorValidSurfaceTest() 100 SurfaceAggregatorValidSurfaceTest()
102 : SurfaceAggregatorValidSurfaceTest(false) {} 101 : SurfaceAggregatorValidSurfaceTest(false) {}
103 102
104 void SetUp() override { 103 void SetUp() override {
105 SurfaceAggregatorTest::SetUp(); 104 SurfaceAggregatorTest::SetUp();
106 root_surface_id_ = allocator_.GenerateId(); 105 root_local_frame_id_ = allocator_.GenerateId();
107 factory_.Create(root_surface_id_); 106 factory_.Create(root_local_frame_id_);
108 root_surface_ = manager_.GetSurfaceForId(root_surface_id_); 107 root_surface_ = manager_.GetSurfaceForId(
108 SurfaceId(factory_.frame_sink_id(), root_local_frame_id_));
109 } 109 }
110 110
111 void TearDown() override { 111 void TearDown() override {
112 factory_.Destroy(root_surface_id_); 112 factory_.Destroy(root_local_frame_id_);
113 SurfaceAggregatorTest::TearDown(); 113 SurfaceAggregatorTest::TearDown();
114 } 114 }
115 115
116 void AggregateAndVerify(test::Pass* expected_passes, 116 void AggregateAndVerify(test::Pass* expected_passes,
117 size_t expected_pass_count, 117 size_t expected_pass_count,
118 SurfaceId* surface_ids, 118 SurfaceId* surface_ids,
119 size_t expected_surface_count) { 119 size_t expected_surface_count) {
120 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 120 CompositorFrame aggregated_frame = aggregator_.Aggregate(
121 SurfaceId(factory_.frame_sink_id(), root_local_frame_id_));
121 122
122 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 123 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
123 124
124 DelegatedFrameData* frame_data = 125 DelegatedFrameData* frame_data =
125 aggregated_frame.delegated_frame_data.get(); 126 aggregated_frame.delegated_frame_data.get();
126 127
127 TestPassesMatchExpectations( 128 TestPassesMatchExpectations(
128 expected_passes, expected_pass_count, &frame_data->render_pass_list); 129 expected_passes, expected_pass_count, &frame_data->render_pass_list);
129 130
130 // Ensure no duplicate pass ids output. 131 // Ensure no duplicate pass ids output.
131 std::set<RenderPassId> used_passes; 132 std::set<RenderPassId> used_passes;
132 for (const auto& pass : frame_data->render_pass_list) { 133 for (const auto& pass : frame_data->render_pass_list) {
133 EXPECT_TRUE(used_passes.insert(pass->id).second); 134 EXPECT_TRUE(used_passes.insert(pass->id).second);
134 } 135 }
135 136
136 EXPECT_EQ(expected_surface_count, 137 EXPECT_EQ(expected_surface_count,
137 aggregator_.previous_contained_surfaces().size()); 138 aggregator_.previous_contained_surfaces().size());
138 for (size_t i = 0; i < expected_surface_count; i++) { 139 for (size_t i = 0; i < expected_surface_count; i++) {
139 EXPECT_TRUE( 140 EXPECT_TRUE(
140 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != 141 aggregator_.previous_contained_surfaces().find(surface_ids[i]) !=
141 aggregator_.previous_contained_surfaces().end()); 142 aggregator_.previous_contained_surfaces().end());
142 } 143 }
143 } 144 }
144 145
145 void SubmitPassListAsFrame(SurfaceFactory* factory, 146 void SubmitPassListAsFrame(SurfaceFactory* factory,
146 const SurfaceId& surface_id, 147 const LocalFrameId& local_frame_id,
147 RenderPassList* pass_list) { 148 RenderPassList* pass_list) {
148 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 149 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
149 pass_list->swap(frame_data->render_pass_list); 150 pass_list->swap(frame_data->render_pass_list);
150 151
151 CompositorFrame frame; 152 CompositorFrame frame;
152 frame.delegated_frame_data = std::move(frame_data); 153 frame.delegated_frame_data = std::move(frame_data);
153 154
154 factory->SubmitCompositorFrame(surface_id, std::move(frame), 155 factory->SubmitCompositorFrame(local_frame_id, std::move(frame),
155 SurfaceFactory::DrawCallback()); 156 SurfaceFactory::DrawCallback());
156 } 157 }
157 158
158 void SubmitCompositorFrame(SurfaceFactory* factory, 159 void SubmitCompositorFrame(SurfaceFactory* factory,
159 test::Pass* passes, 160 test::Pass* passes,
160 size_t pass_count, 161 size_t pass_count,
161 const SurfaceId& surface_id) { 162 const LocalFrameId& local_frame_id) {
162 RenderPassList pass_list; 163 RenderPassList pass_list;
163 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count); 164 AddPasses(&pass_list, gfx::Rect(SurfaceSize()), passes, pass_count);
164 SubmitPassListAsFrame(factory, surface_id, &pass_list); 165 SubmitPassListAsFrame(factory, local_frame_id, &pass_list);
165 } 166 }
166 167
167 void QueuePassAsFrame(std::unique_ptr<RenderPass> pass, 168 void QueuePassAsFrame(std::unique_ptr<RenderPass> pass,
168 const SurfaceId& surface_id) { 169 const LocalFrameId& local_frame_id) {
169 std::unique_ptr<DelegatedFrameData> delegated_frame_data( 170 std::unique_ptr<DelegatedFrameData> delegated_frame_data(
170 new DelegatedFrameData); 171 new DelegatedFrameData);
171 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 172 delegated_frame_data->render_pass_list.push_back(std::move(pass));
172 173
173 CompositorFrame child_frame; 174 CompositorFrame child_frame;
174 child_frame.delegated_frame_data = std::move(delegated_frame_data); 175 child_frame.delegated_frame_data = std::move(delegated_frame_data);
175 176
176 factory_.SubmitCompositorFrame(surface_id, std::move(child_frame), 177 factory_.SubmitCompositorFrame(local_frame_id, std::move(child_frame),
177 SurfaceFactory::DrawCallback()); 178 SurfaceFactory::DrawCallback());
178 } 179 }
179 180
180 protected: 181 protected:
181 SurfaceId root_surface_id_; 182 LocalFrameId root_local_frame_id_;
182 Surface* root_surface_; 183 Surface* root_surface_;
183 SurfaceIdAllocator allocator_; 184 SurfaceIdAllocator allocator_;
184 EmptySurfaceFactoryClient empty_child_client_; 185 EmptySurfaceFactoryClient empty_child_client_;
185 SurfaceFactory child_factory_; 186 SurfaceFactory child_factory_;
186 SurfaceIdAllocator child_allocator_; 187 SurfaceIdAllocator child_allocator_;
187 }; 188 };
188 189
189 // Tests that a very simple frame containing only two solid color quads makes it 190 // Tests that a very simple frame containing only two solid color quads makes it
190 // through the aggregator correctly. 191 // through the aggregator correctly.
191 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) { 192 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleFrame) {
192 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorRED), 193 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorRED),
193 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 194 test::Quad::SolidColorQuad(SK_ColorBLUE)};
194 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; 195 test::Pass passes[] = {test::Pass(quads, arraysize(quads))};
195 196
196 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 197 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
198 root_local_frame_id_);
197 199
198 SurfaceId ids[] = {root_surface_id_}; 200 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
201 SurfaceId ids[] = {root_surface_id};
199 202
200 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); 203 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids));
201 204
202 // Check that WillDrawSurface was called. 205 // Check that WillDrawSurface was called.
203 EXPECT_EQ(gfx::Rect(SurfaceSize()), empty_client_.last_damage_rect_); 206 EXPECT_EQ(gfx::Rect(SurfaceSize()), empty_client_.last_damage_rect_);
204 EXPECT_EQ(root_surface_id_, empty_client_.last_surface_id_); 207 EXPECT_EQ(root_local_frame_id_, empty_client_.last_local_frame_id_);
205 } 208 }
206 209
207 TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) { 210 TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) {
208 SurfaceId embedded_surface_id = allocator_.GenerateId(); 211 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
209 factory_.Create(embedded_surface_id); 212 SurfaceId embedded_surface_id(factory_.frame_sink_id(),
213 embedded_local_frame_id);
214 factory_.Create(embedded_local_frame_id);
210 215
211 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 216 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
212 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 217 test::Quad::SolidColorQuad(SK_ColorBLUE)};
213 test::Pass embedded_passes[] = { 218 test::Pass embedded_passes[] = {
214 test::Pass(embedded_quads, arraysize(embedded_quads))}; 219 test::Pass(embedded_quads, arraysize(embedded_quads))};
215 220
216 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes), 221 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes),
217 embedded_surface_id); 222 embedded_local_frame_id);
218 223
219 test::Quad quads[] = {test::Quad::SurfaceQuad(embedded_surface_id, .5f)}; 224 test::Quad quads[] = {test::Quad::SurfaceQuad(embedded_surface_id, .5f)};
220 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; 225 test::Pass passes[] = {test::Pass(quads, arraysize(quads))};
221 226
222 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 227 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
228 root_local_frame_id_);
223 229
224 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 230 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
231 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
225 232
226 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 233 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
227 234
228 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 235 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
229 236
230 RenderPassList& render_pass_list(frame_data->render_pass_list); 237 RenderPassList& render_pass_list(frame_data->render_pass_list);
231 ASSERT_EQ(2u, render_pass_list.size()); 238 ASSERT_EQ(2u, render_pass_list.size());
232 SharedQuadStateList& shared_quad_state_list( 239 SharedQuadStateList& shared_quad_state_list(
233 render_pass_list[0]->shared_quad_state_list); 240 render_pass_list[0]->shared_quad_state_list);
234 ASSERT_EQ(2u, shared_quad_state_list.size()); 241 ASSERT_EQ(2u, shared_quad_state_list.size());
235 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(0)->opacity); 242 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(0)->opacity);
236 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(1)->opacity); 243 EXPECT_EQ(1.f, shared_quad_state_list.ElementAt(1)->opacity);
237 244
238 SharedQuadStateList& shared_quad_state_list2( 245 SharedQuadStateList& shared_quad_state_list2(
239 render_pass_list[1]->shared_quad_state_list); 246 render_pass_list[1]->shared_quad_state_list);
240 ASSERT_EQ(1u, shared_quad_state_list2.size()); 247 ASSERT_EQ(1u, shared_quad_state_list2.size());
241 EXPECT_EQ(.5f, shared_quad_state_list2.ElementAt(0)->opacity); 248 EXPECT_EQ(.5f, shared_quad_state_list2.ElementAt(0)->opacity);
242 249
243 factory_.Destroy(embedded_surface_id); 250 factory_.Destroy(embedded_local_frame_id);
244 } 251 }
245 252
246 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) { 253 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) {
247 test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE), 254 test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE),
248 test::Quad::SolidColorQuad(SK_ColorLTGRAY)}, 255 test::Quad::SolidColorQuad(SK_ColorLTGRAY)},
249 {test::Quad::SolidColorQuad(SK_ColorGRAY), 256 {test::Quad::SolidColorQuad(SK_ColorGRAY),
250 test::Quad::SolidColorQuad(SK_ColorDKGRAY)}}; 257 test::Quad::SolidColorQuad(SK_ColorDKGRAY)}};
251 test::Pass passes[] = { 258 test::Pass passes[] = {
252 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 1)), 259 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 1)),
253 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 2))}; 260 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 2))};
254 261
255 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 262 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
263 root_local_frame_id_);
256 264
257 SurfaceId ids[] = {root_surface_id_}; 265 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
266 SurfaceId ids[] = {root_surface_id};
258 267
259 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); 268 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids));
260 } 269 }
261 270
262 // This tests very simple embedding. root_surface has a frame containing a few 271 // This tests very simple embedding. root_surface has a frame containing a few
263 // solid color quads and a surface quad referencing embedded_surface. 272 // solid color quads and a surface quad referencing embedded_surface.
264 // embedded_surface has a frame containing only a solid color quad. The solid 273 // embedded_surface has a frame containing only a solid color quad. The solid
265 // color quad should be aggregated into the final frame. 274 // color quad should be aggregated into the final frame.
266 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) { 275 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) {
267 SurfaceId embedded_surface_id = allocator_.GenerateId(); 276 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
268 factory_.Create(embedded_surface_id); 277 SurfaceId embedded_surface_id(factory_.frame_sink_id(),
278 embedded_local_frame_id);
279 factory_.Create(embedded_local_frame_id);
269 280
270 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; 281 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
271 test::Pass embedded_passes[] = { 282 test::Pass embedded_passes[] = {
272 test::Pass(embedded_quads, arraysize(embedded_quads))}; 283 test::Pass(embedded_quads, arraysize(embedded_quads))};
273 284
274 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes), 285 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes),
275 embedded_surface_id); 286 embedded_local_frame_id);
276 287
277 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 288 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
278 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), 289 test::Quad::SurfaceQuad(embedded_surface_id, 1.f),
279 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 290 test::Quad::SolidColorQuad(SK_ColorBLACK)};
280 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 291 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
281 292
282 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes), 293 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes),
283 root_surface_id_); 294 root_local_frame_id_);
284 295
285 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 296 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
286 test::Quad::SolidColorQuad(SK_ColorGREEN), 297 test::Quad::SolidColorQuad(SK_ColorGREEN),
287 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 298 test::Quad::SolidColorQuad(SK_ColorBLACK)};
288 test::Pass expected_passes[] = { 299 test::Pass expected_passes[] = {
289 test::Pass(expected_quads, arraysize(expected_quads))}; 300 test::Pass(expected_quads, arraysize(expected_quads))};
290 SurfaceId ids[] = {root_surface_id_, embedded_surface_id}; 301 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
302 SurfaceId ids[] = {root_surface_id, embedded_surface_id};
291 AggregateAndVerify( 303 AggregateAndVerify(
292 expected_passes, arraysize(expected_passes), ids, arraysize(ids)); 304 expected_passes, arraysize(expected_passes), ids, arraysize(ids));
293 305
294 factory_.Destroy(embedded_surface_id); 306 factory_.Destroy(embedded_local_frame_id);
295 } 307 }
296 308
297 TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) { 309 TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) {
298 SurfaceId embedded_surface_id = allocator_.GenerateId(); 310 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
299 factory_.Create(embedded_surface_id); 311 SurfaceId embedded_surface_id(factory_.frame_sink_id(),
312 embedded_local_frame_id);
313 factory_.Create(embedded_local_frame_id);
300 314
301 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; 315 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
302 test::Pass embedded_passes[] = { 316 test::Pass embedded_passes[] = {
303 test::Pass(embedded_quads, arraysize(embedded_quads))}; 317 test::Pass(embedded_quads, arraysize(embedded_quads))};
304 318
305 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes), 319 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes),
306 embedded_surface_id); 320 embedded_local_frame_id);
307 std::unique_ptr<CopyOutputRequest> copy_request( 321 std::unique_ptr<CopyOutputRequest> copy_request(
308 CopyOutputRequest::CreateEmptyRequest()); 322 CopyOutputRequest::CreateEmptyRequest());
309 CopyOutputRequest* copy_request_ptr = copy_request.get(); 323 CopyOutputRequest* copy_request_ptr = copy_request.get();
310 factory_.RequestCopyOfSurface(embedded_surface_id, std::move(copy_request)); 324 factory_.RequestCopyOfSurface(embedded_local_frame_id,
325 std::move(copy_request));
311 326
312 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 327 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
313 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), 328 test::Quad::SurfaceQuad(embedded_surface_id, 1.f),
314 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 329 test::Quad::SolidColorQuad(SK_ColorBLACK)};
315 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 330 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
316 331
317 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes), 332 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes),
318 root_surface_id_); 333 root_local_frame_id_);
319 334
320 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 335 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
336 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
321 337
322 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 338 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
323 339
324 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 340 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
325 341
326 test::Quad expected_quads[] = { 342 test::Quad expected_quads[] = {
327 test::Quad::SolidColorQuad(SK_ColorWHITE), 343 test::Quad::SolidColorQuad(SK_ColorWHITE),
328 test::Quad::RenderPassQuad(frame_data->render_pass_list[0]->id), 344 test::Quad::RenderPassQuad(frame_data->render_pass_list[0]->id),
329 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 345 test::Quad::SolidColorQuad(SK_ColorBLACK)};
330 test::Pass expected_passes[] = { 346 test::Pass expected_passes[] = {
331 test::Pass(embedded_quads, arraysize(embedded_quads)), 347 test::Pass(embedded_quads, arraysize(embedded_quads)),
332 test::Pass(expected_quads, arraysize(expected_quads))}; 348 test::Pass(expected_quads, arraysize(expected_quads))};
333 TestPassesMatchExpectations(expected_passes, 349 TestPassesMatchExpectations(expected_passes,
334 arraysize(expected_passes), 350 arraysize(expected_passes),
335 &frame_data->render_pass_list); 351 &frame_data->render_pass_list);
336 ASSERT_EQ(2u, frame_data->render_pass_list.size()); 352 ASSERT_EQ(2u, frame_data->render_pass_list.size());
337 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size()); 353 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
338 DCHECK_EQ(copy_request_ptr, 354 DCHECK_EQ(copy_request_ptr,
339 frame_data->render_pass_list[0]->copy_requests[0].get()); 355 frame_data->render_pass_list[0]->copy_requests[0].get());
340 356
341 SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id}; 357 SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id};
342 EXPECT_EQ(arraysize(surface_ids), 358 EXPECT_EQ(arraysize(surface_ids),
343 aggregator_.previous_contained_surfaces().size()); 359 aggregator_.previous_contained_surfaces().size());
344 for (size_t i = 0; i < arraysize(surface_ids); i++) { 360 for (size_t i = 0; i < arraysize(surface_ids); i++) {
345 EXPECT_TRUE( 361 EXPECT_TRUE(
346 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != 362 aggregator_.previous_contained_surfaces().find(surface_ids[i]) !=
347 aggregator_.previous_contained_surfaces().end()); 363 aggregator_.previous_contained_surfaces().end());
348 } 364 }
349 365
350 factory_.Destroy(embedded_surface_id); 366 factory_.Destroy(embedded_local_frame_id);
351 } 367 }
352 368
353 // Root surface may contain copy requests. 369 // Root surface may contain copy requests.
354 TEST_F(SurfaceAggregatorValidSurfaceTest, RootCopyRequest) { 370 TEST_F(SurfaceAggregatorValidSurfaceTest, RootCopyRequest) {
355 SurfaceId embedded_surface_id = allocator_.GenerateId(); 371 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
356 factory_.Create(embedded_surface_id); 372 SurfaceId embedded_surface_id(factory_.frame_sink_id(),
373 embedded_local_frame_id);
374 factory_.Create(embedded_local_frame_id);
357 375
358 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; 376 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
359 test::Pass embedded_passes[] = { 377 test::Pass embedded_passes[] = {
360 test::Pass(embedded_quads, arraysize(embedded_quads))}; 378 test::Pass(embedded_quads, arraysize(embedded_quads))};
361 379
362 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes), 380 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes),
363 embedded_surface_id); 381 embedded_local_frame_id);
364 std::unique_ptr<CopyOutputRequest> copy_request( 382 std::unique_ptr<CopyOutputRequest> copy_request(
365 CopyOutputRequest::CreateEmptyRequest()); 383 CopyOutputRequest::CreateEmptyRequest());
366 CopyOutputRequest* copy_request_ptr = copy_request.get(); 384 CopyOutputRequest* copy_request_ptr = copy_request.get();
367 std::unique_ptr<CopyOutputRequest> copy_request2( 385 std::unique_ptr<CopyOutputRequest> copy_request2(
368 CopyOutputRequest::CreateEmptyRequest()); 386 CopyOutputRequest::CreateEmptyRequest());
369 CopyOutputRequest* copy_request2_ptr = copy_request2.get(); 387 CopyOutputRequest* copy_request2_ptr = copy_request2.get();
370 388
371 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 389 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
372 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), 390 test::Quad::SurfaceQuad(embedded_surface_id, 1.f),
373 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 391 test::Quad::SolidColorQuad(SK_ColorBLACK)};
374 test::Quad root_quads2[] = {test::Quad::SolidColorQuad(SK_ColorRED)}; 392 test::Quad root_quads2[] = {test::Quad::SolidColorQuad(SK_ColorRED)};
375 test::Pass root_passes[] = { 393 test::Pass root_passes[] = {
376 test::Pass(root_quads, arraysize(root_quads), RenderPassId(1, 1)), 394 test::Pass(root_quads, arraysize(root_quads), RenderPassId(1, 1)),
377 test::Pass(root_quads2, arraysize(root_quads2), RenderPassId(1, 2))}; 395 test::Pass(root_quads2, arraysize(root_quads2), RenderPassId(1, 2))};
378 { 396 {
379 RenderPassList pass_list; 397 RenderPassList pass_list;
380 AddPasses(&pass_list, 398 AddPasses(&pass_list,
381 gfx::Rect(SurfaceSize()), 399 gfx::Rect(SurfaceSize()),
382 root_passes, 400 root_passes,
383 arraysize(root_passes)); 401 arraysize(root_passes));
384 pass_list[0]->copy_requests.push_back(std::move(copy_request)); 402 pass_list[0]->copy_requests.push_back(std::move(copy_request));
385 pass_list[1]->copy_requests.push_back(std::move(copy_request2)); 403 pass_list[1]->copy_requests.push_back(std::move(copy_request2));
386 404
387 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 405 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
388 pass_list.swap(frame_data->render_pass_list); 406 pass_list.swap(frame_data->render_pass_list);
389 407
390 CompositorFrame frame; 408 CompositorFrame frame;
391 frame.delegated_frame_data = std::move(frame_data); 409 frame.delegated_frame_data = std::move(frame_data);
392 410
393 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), 411 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(frame),
394 SurfaceFactory::DrawCallback()); 412 SurfaceFactory::DrawCallback());
395 } 413 }
396 414
397 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 415 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
416 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
398 417
399 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 418 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
400 419
401 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 420 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
402 421
403 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 422 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
404 test::Quad::SolidColorQuad(SK_ColorGREEN), 423 test::Quad::SolidColorQuad(SK_ColorGREEN),
405 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 424 test::Quad::SolidColorQuad(SK_ColorBLACK)};
406 test::Pass expected_passes[] = { 425 test::Pass expected_passes[] = {
407 test::Pass(expected_quads, arraysize(expected_quads)), 426 test::Pass(expected_quads, arraysize(expected_quads)),
408 test::Pass(root_quads2, arraysize(root_quads2))}; 427 test::Pass(root_quads2, arraysize(root_quads2))};
409 TestPassesMatchExpectations(expected_passes, 428 TestPassesMatchExpectations(expected_passes,
410 arraysize(expected_passes), 429 arraysize(expected_passes),
411 &frame_data->render_pass_list); 430 &frame_data->render_pass_list);
412 ASSERT_EQ(2u, frame_data->render_pass_list.size()); 431 ASSERT_EQ(2u, frame_data->render_pass_list.size());
413 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size()); 432 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
414 DCHECK_EQ(copy_request_ptr, 433 DCHECK_EQ(copy_request_ptr,
415 frame_data->render_pass_list[0]->copy_requests[0].get()); 434 frame_data->render_pass_list[0]->copy_requests[0].get());
416 ASSERT_EQ(1u, frame_data->render_pass_list[1]->copy_requests.size()); 435 ASSERT_EQ(1u, frame_data->render_pass_list[1]->copy_requests.size());
417 DCHECK_EQ(copy_request2_ptr, 436 DCHECK_EQ(copy_request2_ptr,
418 frame_data->render_pass_list[1]->copy_requests[0].get()); 437 frame_data->render_pass_list[1]->copy_requests[0].get());
419 438
420 SurfaceId surface_ids[] = {root_surface_id_, embedded_surface_id}; 439 SurfaceId surface_ids[] = {root_surface_id, embedded_surface_id};
421 EXPECT_EQ(arraysize(surface_ids), 440 EXPECT_EQ(arraysize(surface_ids),
422 aggregator_.previous_contained_surfaces().size()); 441 aggregator_.previous_contained_surfaces().size());
423 for (size_t i = 0; i < arraysize(surface_ids); i++) { 442 for (size_t i = 0; i < arraysize(surface_ids); i++) {
424 EXPECT_TRUE( 443 EXPECT_TRUE(
425 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != 444 aggregator_.previous_contained_surfaces().find(surface_ids[i]) !=
426 aggregator_.previous_contained_surfaces().end()); 445 aggregator_.previous_contained_surfaces().end());
427 } 446 }
428 447
429 // Ensure copy requests have been removed from root surface. 448 // Ensure copy requests have been removed from root surface.
430 const CompositorFrame& original_frame = 449 const CompositorFrame& original_frame =
431 manager_.GetSurfaceForId(root_surface_id_)->GetEligibleFrame(); 450 manager_.GetSurfaceForId(root_surface_id)->GetEligibleFrame();
432 RenderPassList& original_pass_list = 451 RenderPassList& original_pass_list =
433 original_frame.delegated_frame_data->render_pass_list; 452 original_frame.delegated_frame_data->render_pass_list;
434 ASSERT_EQ(2u, original_pass_list.size()); 453 ASSERT_EQ(2u, original_pass_list.size());
435 DCHECK(original_pass_list[0]->copy_requests.empty()); 454 DCHECK(original_pass_list[0]->copy_requests.empty());
436 DCHECK(original_pass_list[1]->copy_requests.empty()); 455 DCHECK(original_pass_list[1]->copy_requests.empty());
437 456
438 factory_.Destroy(embedded_surface_id); 457 factory_.Destroy(embedded_local_frame_id);
439 } 458 }
440 459
441 TEST_F(SurfaceAggregatorValidSurfaceTest, UnreferencedSurface) { 460 TEST_F(SurfaceAggregatorValidSurfaceTest, UnreferencedSurface) {
442 SurfaceId embedded_surface_id = allocator_.GenerateId(); 461 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
443 SurfaceId nonexistent_surface_id = allocator_.GenerateId(); 462 SurfaceId embedded_surface_id(factory_.frame_sink_id(),
444 factory_.Create(embedded_surface_id); 463 embedded_local_frame_id);
464 SurfaceId nonexistent_surface_id(factory_.frame_sink_id(),
465 allocator_.GenerateId());
466 factory_.Create(embedded_local_frame_id);
445 467
446 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; 468 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
447 test::Pass embedded_passes[] = { 469 test::Pass embedded_passes[] = {
448 test::Pass(embedded_quads, arraysize(embedded_quads))}; 470 test::Pass(embedded_quads, arraysize(embedded_quads))};
449 471
450 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes), 472 SubmitCompositorFrame(&factory_, embedded_passes, arraysize(embedded_passes),
451 embedded_surface_id); 473 embedded_local_frame_id);
452 std::unique_ptr<CopyOutputRequest> copy_request( 474 std::unique_ptr<CopyOutputRequest> copy_request(
453 CopyOutputRequest::CreateEmptyRequest()); 475 CopyOutputRequest::CreateEmptyRequest());
454 CopyOutputRequest* copy_request_ptr = copy_request.get(); 476 CopyOutputRequest* copy_request_ptr = copy_request.get();
455 factory_.RequestCopyOfSurface(embedded_surface_id, std::move(copy_request)); 477 factory_.RequestCopyOfSurface(embedded_local_frame_id,
478 std::move(copy_request));
456 479
457 SurfaceId parent_surface_id = allocator_.GenerateId(); 480 LocalFrameId parent_local_frame_id = allocator_.GenerateId();
458 factory_.Create(parent_surface_id); 481 SurfaceId parent_surface_id(factory_.frame_sink_id(), parent_local_frame_id);
482 factory_.Create(parent_local_frame_id);
459 483
460 test::Quad parent_quads[] = { 484 test::Quad parent_quads[] = {
461 test::Quad::SolidColorQuad(SK_ColorWHITE), 485 test::Quad::SolidColorQuad(SK_ColorWHITE),
462 test::Quad::SurfaceQuad(embedded_surface_id, 1.f), 486 test::Quad::SurfaceQuad(embedded_surface_id, 1.f),
463 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 487 test::Quad::SolidColorQuad(SK_ColorBLACK)};
464 test::Pass parent_passes[] = { 488 test::Pass parent_passes[] = {
465 test::Pass(parent_quads, arraysize(parent_quads))}; 489 test::Pass(parent_quads, arraysize(parent_quads))};
466 490
467 { 491 {
468 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 492 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
469 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), 493 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()),
470 parent_passes, arraysize(parent_passes)); 494 parent_passes, arraysize(parent_passes));
471 495
472 CompositorFrame frame; 496 CompositorFrame frame;
473 frame.delegated_frame_data = std::move(frame_data); 497 frame.delegated_frame_data = std::move(frame_data);
474 frame.metadata.referenced_surfaces.push_back(embedded_surface_id); 498 frame.metadata.referenced_surfaces.push_back(embedded_surface_id);
475 499
476 factory_.SubmitCompositorFrame(parent_surface_id, std::move(frame), 500 factory_.SubmitCompositorFrame(parent_local_frame_id, std::move(frame),
477 SurfaceFactory::DrawCallback()); 501 SurfaceFactory::DrawCallback());
478 } 502 }
479 503
480 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE), 504 test::Quad root_quads[] = {test::Quad::SolidColorQuad(SK_ColorWHITE),
481 test::Quad::SolidColorQuad(SK_ColorBLACK)}; 505 test::Quad::SolidColorQuad(SK_ColorBLACK)};
482 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 506 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
483 507
484 { 508 {
485 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 509 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
486 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()), 510 AddPasses(&frame_data->render_pass_list, gfx::Rect(SurfaceSize()),
487 root_passes, arraysize(root_passes)); 511 root_passes, arraysize(root_passes));
488 512
489 CompositorFrame frame; 513 CompositorFrame frame;
490 frame.delegated_frame_data = std::move(frame_data); 514 frame.delegated_frame_data = std::move(frame_data);
491 frame.metadata.referenced_surfaces.push_back(parent_surface_id); 515 frame.metadata.referenced_surfaces.push_back(parent_surface_id);
492 // Reference to Surface ID of a Surface that doesn't exist should be 516 // Reference to Surface ID of a Surface that doesn't exist should be
493 // included in previous_contained_surfaces, but otherwise ignored. 517 // included in previous_contained_surfaces, but otherwise ignored.
494 frame.metadata.referenced_surfaces.push_back(nonexistent_surface_id); 518 frame.metadata.referenced_surfaces.push_back(nonexistent_surface_id);
495 519
496 factory_.SubmitCompositorFrame(root_surface_id_, std::move(frame), 520 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(frame),
497 SurfaceFactory::DrawCallback()); 521 SurfaceFactory::DrawCallback());
498 } 522 }
499 523
500 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 524 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
525 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
501 526
502 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 527 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
503 528
504 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 529 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
505 530
506 // First pass should come from surface that had a copy request but was not 531 // First pass should come from surface that had a copy request but was not
507 // referenced directly. The second pass comes from the root surface. 532 // referenced directly. The second pass comes from the root surface.
508 // parent_quad should be ignored because it is neither referenced through a 533 // parent_quad should be ignored because it is neither referenced through a
509 // SurfaceDrawQuad nor has a copy request on it. 534 // SurfaceDrawQuad nor has a copy request on it.
510 test::Pass expected_passes[] = { 535 test::Pass expected_passes[] = {
511 test::Pass(embedded_quads, arraysize(embedded_quads)), 536 test::Pass(embedded_quads, arraysize(embedded_quads)),
512 test::Pass(root_quads, arraysize(root_quads))}; 537 test::Pass(root_quads, arraysize(root_quads))};
513 TestPassesMatchExpectations(expected_passes, arraysize(expected_passes), 538 TestPassesMatchExpectations(expected_passes, arraysize(expected_passes),
514 &frame_data->render_pass_list); 539 &frame_data->render_pass_list);
515 ASSERT_EQ(2u, frame_data->render_pass_list.size()); 540 ASSERT_EQ(2u, frame_data->render_pass_list.size());
516 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size()); 541 ASSERT_EQ(1u, frame_data->render_pass_list[0]->copy_requests.size());
517 DCHECK_EQ(copy_request_ptr, 542 DCHECK_EQ(copy_request_ptr,
518 frame_data->render_pass_list[0]->copy_requests[0].get()); 543 frame_data->render_pass_list[0]->copy_requests[0].get());
519 544
520 SurfaceId surface_ids[] = {root_surface_id_, parent_surface_id, 545 SurfaceId surface_ids[] = {
521 embedded_surface_id, nonexistent_surface_id}; 546 SurfaceId(factory_.frame_sink_id(), root_local_frame_id_),
547 parent_surface_id, embedded_surface_id, nonexistent_surface_id};
522 EXPECT_EQ(arraysize(surface_ids), 548 EXPECT_EQ(arraysize(surface_ids),
523 aggregator_.previous_contained_surfaces().size()); 549 aggregator_.previous_contained_surfaces().size());
524 for (size_t i = 0; i < arraysize(surface_ids); i++) { 550 for (size_t i = 0; i < arraysize(surface_ids); i++) {
525 EXPECT_TRUE( 551 EXPECT_TRUE(
526 aggregator_.previous_contained_surfaces().find(surface_ids[i]) != 552 aggregator_.previous_contained_surfaces().find(surface_ids[i]) !=
527 aggregator_.previous_contained_surfaces().end()); 553 aggregator_.previous_contained_surfaces().end());
528 } 554 }
529 555
530 factory_.Destroy(parent_surface_id); 556 factory_.Destroy(parent_local_frame_id);
531 factory_.Destroy(embedded_surface_id); 557 factory_.Destroy(embedded_local_frame_id);
532 } 558 }
533 559
534 // This tests referencing a surface that has multiple render passes. 560 // This tests referencing a surface that has multiple render passes.
535 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) { 561 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSurfaceReference) {
536 SurfaceId embedded_surface_id = child_allocator_.GenerateId(); 562 LocalFrameId embedded_local_frame_id = child_allocator_.GenerateId();
537 child_factory_.Create(embedded_surface_id); 563 SurfaceId embedded_surface_id(child_factory_.frame_sink_id(),
564 embedded_local_frame_id);
565 child_factory_.Create(embedded_local_frame_id);
538 566
539 RenderPassId pass_ids[] = {RenderPassId(1, 1), RenderPassId(1, 2), 567 RenderPassId pass_ids[] = {RenderPassId(1, 1), RenderPassId(1, 2),
540 RenderPassId(1, 3)}; 568 RenderPassId(1, 3)};
541 569
542 test::Quad embedded_quads[][2] = { 570 test::Quad embedded_quads[][2] = {
543 {test::Quad::SolidColorQuad(1), test::Quad::SolidColorQuad(2)}, 571 {test::Quad::SolidColorQuad(1), test::Quad::SolidColorQuad(2)},
544 {test::Quad::SolidColorQuad(3), test::Quad::RenderPassQuad(pass_ids[0])}, 572 {test::Quad::SolidColorQuad(3), test::Quad::RenderPassQuad(pass_ids[0])},
545 {test::Quad::SolidColorQuad(4), test::Quad::RenderPassQuad(pass_ids[1])}}; 573 {test::Quad::SolidColorQuad(4), test::Quad::RenderPassQuad(pass_ids[1])}};
546 test::Pass embedded_passes[] = { 574 test::Pass embedded_passes[] = {
547 test::Pass(embedded_quads[0], arraysize(embedded_quads[0]), pass_ids[0]), 575 test::Pass(embedded_quads[0], arraysize(embedded_quads[0]), pass_ids[0]),
548 test::Pass(embedded_quads[1], arraysize(embedded_quads[1]), pass_ids[1]), 576 test::Pass(embedded_quads[1], arraysize(embedded_quads[1]), pass_ids[1]),
549 test::Pass(embedded_quads[2], arraysize(embedded_quads[2]), pass_ids[2])}; 577 test::Pass(embedded_quads[2], arraysize(embedded_quads[2]), pass_ids[2])};
550 578
551 SubmitCompositorFrame(&child_factory_, embedded_passes, 579 SubmitCompositorFrame(&child_factory_, embedded_passes,
552 arraysize(embedded_passes), embedded_surface_id); 580 arraysize(embedded_passes), embedded_local_frame_id);
553 581
554 test::Quad root_quads[][2] = { 582 test::Quad root_quads[][2] = {
555 {test::Quad::SolidColorQuad(5), test::Quad::SolidColorQuad(6)}, 583 {test::Quad::SolidColorQuad(5), test::Quad::SolidColorQuad(6)},
556 {test::Quad::SurfaceQuad(embedded_surface_id, 1.f), 584 {test::Quad::SurfaceQuad(embedded_surface_id, 1.f),
557 test::Quad::RenderPassQuad(pass_ids[0])}, 585 test::Quad::RenderPassQuad(pass_ids[0])},
558 {test::Quad::SolidColorQuad(7), test::Quad::RenderPassQuad(pass_ids[1])}}; 586 {test::Quad::SolidColorQuad(7), test::Quad::RenderPassQuad(pass_ids[1])}};
559 test::Pass root_passes[] = { 587 test::Pass root_passes[] = {
560 test::Pass(root_quads[0], arraysize(root_quads[0]), pass_ids[0]), 588 test::Pass(root_quads[0], arraysize(root_quads[0]), pass_ids[0]),
561 test::Pass(root_quads[1], arraysize(root_quads[1]), pass_ids[1]), 589 test::Pass(root_quads[1], arraysize(root_quads[1]), pass_ids[1]),
562 test::Pass(root_quads[2], arraysize(root_quads[2]), pass_ids[2])}; 590 test::Pass(root_quads[2], arraysize(root_quads[2]), pass_ids[2])};
563 591
564 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes), 592 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes),
565 root_surface_id_); 593 root_local_frame_id_);
566 594
567 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 595 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
596 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
568 597
569 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 598 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
570 599
571 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 600 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
572 601
573 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 602 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
574 603
575 ASSERT_EQ(5u, aggregated_pass_list.size()); 604 ASSERT_EQ(5u, aggregated_pass_list.size());
576 RenderPassId actual_pass_ids[] = { 605 RenderPassId actual_pass_ids[] = {
577 aggregated_pass_list[0]->id, aggregated_pass_list[1]->id, 606 aggregated_pass_list[0]->id, aggregated_pass_list[1]->id,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // The last quad in the last pass will reference the second pass from the 689 // The last quad in the last pass will reference the second pass from the
661 // root surface, which after aggregating is the fourth pass in the overall 690 // root surface, which after aggregating is the fourth pass in the overall
662 // list. 691 // list.
663 ASSERT_EQ(DrawQuad::RENDER_PASS, 692 ASSERT_EQ(DrawQuad::RENDER_PASS,
664 fifth_pass_quad_list.ElementAt(1)->material); 693 fifth_pass_quad_list.ElementAt(1)->material);
665 const RenderPassDrawQuad* fifth_pass_render_pass_draw_quad = 694 const RenderPassDrawQuad* fifth_pass_render_pass_draw_quad =
666 RenderPassDrawQuad::MaterialCast(fifth_pass_quad_list.ElementAt(1)); 695 RenderPassDrawQuad::MaterialCast(fifth_pass_quad_list.ElementAt(1));
667 EXPECT_EQ(actual_pass_ids[3], 696 EXPECT_EQ(actual_pass_ids[3],
668 fifth_pass_render_pass_draw_quad->render_pass_id); 697 fifth_pass_render_pass_draw_quad->render_pass_id);
669 } 698 }
670 child_factory_.Destroy(embedded_surface_id); 699 child_factory_.Destroy(embedded_local_frame_id);
671 } 700 }
672 701
673 // Tests an invalid surface reference in a frame. The surface quad should just 702 // Tests an invalid surface reference in a frame. The surface quad should just
674 // be dropped. 703 // be dropped.
675 TEST_F(SurfaceAggregatorValidSurfaceTest, InvalidSurfaceReference) { 704 TEST_F(SurfaceAggregatorValidSurfaceTest, InvalidSurfaceReference) {
676 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 705 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
677 test::Quad::SurfaceQuad(InvalidSurfaceId(), 1.f), 706 test::Quad::SurfaceQuad(InvalidSurfaceId(), 1.f),
678 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 707 test::Quad::SolidColorQuad(SK_ColorBLUE)};
679 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; 708 test::Pass passes[] = {test::Pass(quads, arraysize(quads))};
680 709
681 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 710 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
711 root_local_frame_id_);
682 712
683 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 713 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
684 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 714 test::Quad::SolidColorQuad(SK_ColorBLUE)};
685 test::Pass expected_passes[] = { 715 test::Pass expected_passes[] = {
686 test::Pass(expected_quads, arraysize(expected_quads))}; 716 test::Pass(expected_quads, arraysize(expected_quads))};
687 SurfaceId ids[] = {root_surface_id_, InvalidSurfaceId()}; 717 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
718 SurfaceId ids[] = {root_surface_id, InvalidSurfaceId()};
688 719
689 AggregateAndVerify( 720 AggregateAndVerify(
690 expected_passes, arraysize(expected_passes), ids, arraysize(ids)); 721 expected_passes, arraysize(expected_passes), ids, arraysize(ids));
691 } 722 }
692 723
693 // Tests a reference to a valid surface with no submitted frame. This quad 724 // Tests a reference to a valid surface with no submitted frame. This quad
694 // should also just be dropped. 725 // should also just be dropped.
695 TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) { 726 TEST_F(SurfaceAggregatorValidSurfaceTest, ValidSurfaceReferenceWithNoFrame) {
696 SurfaceId surface_with_no_frame_id = allocator_.GenerateId(); 727 LocalFrameId empty_local_frame_id = allocator_.GenerateId();
697 factory_.Create(surface_with_no_frame_id); 728 SurfaceId surface_with_no_frame_id(factory_.frame_sink_id(),
729 empty_local_frame_id);
730 factory_.Create(empty_local_frame_id);
698 731
699 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 732 test::Quad quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
700 test::Quad::SurfaceQuad(surface_with_no_frame_id, 1.f), 733 test::Quad::SurfaceQuad(surface_with_no_frame_id, 1.f),
701 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 734 test::Quad::SolidColorQuad(SK_ColorBLUE)};
702 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; 735 test::Pass passes[] = {test::Pass(quads, arraysize(quads))};
703 736
704 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 737 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
738 root_local_frame_id_);
705 739
706 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 740 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
707 test::Quad::SolidColorQuad(SK_ColorBLUE)}; 741 test::Quad::SolidColorQuad(SK_ColorBLUE)};
708 test::Pass expected_passes[] = { 742 test::Pass expected_passes[] = {
709 test::Pass(expected_quads, arraysize(expected_quads))}; 743 test::Pass(expected_quads, arraysize(expected_quads))};
710 SurfaceId ids[] = {root_surface_id_, surface_with_no_frame_id}; 744 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
745 SurfaceId ids[] = {root_surface_id, surface_with_no_frame_id};
711 AggregateAndVerify( 746 AggregateAndVerify(
712 expected_passes, arraysize(expected_passes), ids, arraysize(ids)); 747 expected_passes, arraysize(expected_passes), ids, arraysize(ids));
713 factory_.Destroy(surface_with_no_frame_id); 748 factory_.Destroy(empty_local_frame_id);
714 } 749 }
715 750
716 // Tests a surface quad referencing itself, generating a trivial cycle. 751 // Tests a surface quad referencing itself, generating a trivial cycle.
717 // The quad creating the cycle should be dropped from the final frame. 752 // The quad creating the cycle should be dropped from the final frame.
718 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleCyclicalReference) { 753 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleCyclicalReference) {
719 test::Quad quads[] = {test::Quad::SurfaceQuad(root_surface_id_, 1.f), 754 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
755 test::Quad quads[] = {test::Quad::SurfaceQuad(root_surface_id, 1.f),
720 test::Quad::SolidColorQuad(SK_ColorYELLOW)}; 756 test::Quad::SolidColorQuad(SK_ColorYELLOW)};
721 test::Pass passes[] = {test::Pass(quads, arraysize(quads))}; 757 test::Pass passes[] = {test::Pass(quads, arraysize(quads))};
722 758
723 SubmitCompositorFrame(&factory_, passes, arraysize(passes), root_surface_id_); 759 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
760 root_local_frame_id_);
724 761
725 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorYELLOW)}; 762 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorYELLOW)};
726 test::Pass expected_passes[] = { 763 test::Pass expected_passes[] = {
727 test::Pass(expected_quads, arraysize(expected_quads))}; 764 test::Pass(expected_quads, arraysize(expected_quads))};
728 SurfaceId ids[] = {root_surface_id_}; 765 SurfaceId ids[] = {root_surface_id};
729 AggregateAndVerify( 766 AggregateAndVerify(
730 expected_passes, arraysize(expected_passes), ids, arraysize(ids)); 767 expected_passes, arraysize(expected_passes), ids, arraysize(ids));
731 } 768 }
732 769
733 // Tests a more complex cycle with one intermediate surface. 770 // Tests a more complex cycle with one intermediate surface.
734 TEST_F(SurfaceAggregatorValidSurfaceTest, TwoSurfaceCyclicalReference) { 771 TEST_F(SurfaceAggregatorValidSurfaceTest, TwoSurfaceCyclicalReference) {
735 SurfaceId child_surface_id = allocator_.GenerateId(); 772 LocalFrameId child_local_frame_id = allocator_.GenerateId();
736 factory_.Create(child_surface_id); 773 SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
774 factory_.Create(child_local_frame_id);
737 775
738 test::Quad parent_quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE), 776 test::Quad parent_quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE),
739 test::Quad::SurfaceQuad(child_surface_id, 1.f), 777 test::Quad::SurfaceQuad(child_surface_id, 1.f),
740 test::Quad::SolidColorQuad(SK_ColorCYAN)}; 778 test::Quad::SolidColorQuad(SK_ColorCYAN)};
741 test::Pass parent_passes[] = { 779 test::Pass parent_passes[] = {
742 test::Pass(parent_quads, arraysize(parent_quads))}; 780 test::Pass(parent_quads, arraysize(parent_quads))};
743 781
744 SubmitCompositorFrame(&factory_, parent_passes, arraysize(parent_passes), 782 SubmitCompositorFrame(&factory_, parent_passes, arraysize(parent_passes),
745 root_surface_id_); 783 root_local_frame_id_);
746 784
785 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
747 test::Quad child_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN), 786 test::Quad child_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN),
748 test::Quad::SurfaceQuad(root_surface_id_, 1.f), 787 test::Quad::SurfaceQuad(root_surface_id, 1.f),
749 test::Quad::SolidColorQuad(SK_ColorMAGENTA)}; 788 test::Quad::SolidColorQuad(SK_ColorMAGENTA)};
750 test::Pass child_passes[] = {test::Pass(child_quads, arraysize(child_quads))}; 789 test::Pass child_passes[] = {test::Pass(child_quads, arraysize(child_quads))};
751 790
752 SubmitCompositorFrame(&factory_, child_passes, arraysize(child_passes), 791 SubmitCompositorFrame(&factory_, child_passes, arraysize(child_passes),
753 child_surface_id); 792 child_local_frame_id);
754 793
755 // The child surface's reference to the root_surface_ will be dropped, so 794 // The child surface's reference to the root_surface_ will be dropped, so
756 // we'll end up with: 795 // we'll end up with:
757 // SK_ColorBLUE from the parent 796 // SK_ColorBLUE from the parent
758 // SK_ColorGREEN from the child 797 // SK_ColorGREEN from the child
759 // SK_ColorMAGENTA from the child 798 // SK_ColorMAGENTA from the child
760 // SK_ColorCYAN from the parent 799 // SK_ColorCYAN from the parent
761 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE), 800 test::Quad expected_quads[] = {test::Quad::SolidColorQuad(SK_ColorBLUE),
762 test::Quad::SolidColorQuad(SK_ColorGREEN), 801 test::Quad::SolidColorQuad(SK_ColorGREEN),
763 test::Quad::SolidColorQuad(SK_ColorMAGENTA), 802 test::Quad::SolidColorQuad(SK_ColorMAGENTA),
764 test::Quad::SolidColorQuad(SK_ColorCYAN)}; 803 test::Quad::SolidColorQuad(SK_ColorCYAN)};
765 test::Pass expected_passes[] = { 804 test::Pass expected_passes[] = {
766 test::Pass(expected_quads, arraysize(expected_quads))}; 805 test::Pass(expected_quads, arraysize(expected_quads))};
767 SurfaceId ids[] = {root_surface_id_, child_surface_id}; 806 SurfaceId ids[] = {root_surface_id, child_surface_id};
768 AggregateAndVerify( 807 AggregateAndVerify(
769 expected_passes, arraysize(expected_passes), ids, arraysize(ids)); 808 expected_passes, arraysize(expected_passes), ids, arraysize(ids));
770 factory_.Destroy(child_surface_id); 809 factory_.Destroy(child_local_frame_id);
771 } 810 }
772 811
773 // Tests that we map render pass IDs from different surfaces into a unified 812 // Tests that we map render pass IDs from different surfaces into a unified
774 // namespace and update RenderPassDrawQuad's id references to match. 813 // namespace and update RenderPassDrawQuad's id references to match.
775 TEST_F(SurfaceAggregatorValidSurfaceTest, RenderPassIdMapping) { 814 TEST_F(SurfaceAggregatorValidSurfaceTest, RenderPassIdMapping) {
776 SurfaceId child_surface_id = allocator_.GenerateId(); 815 LocalFrameId child_local_frame_id = allocator_.GenerateId();
777 factory_.Create(child_surface_id); 816 SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
817 factory_.Create(child_local_frame_id);
778 818
779 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)}; 819 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)};
780 test::Quad child_quad[][1] = {{test::Quad::SolidColorQuad(SK_ColorGREEN)}, 820 test::Quad child_quad[][1] = {{test::Quad::SolidColorQuad(SK_ColorGREEN)},
781 {test::Quad::RenderPassQuad(child_pass_id[0])}}; 821 {test::Quad::RenderPassQuad(child_pass_id[0])}};
782 test::Pass surface_passes[] = { 822 test::Pass surface_passes[] = {
783 test::Pass(child_quad[0], arraysize(child_quad[0]), child_pass_id[0]), 823 test::Pass(child_quad[0], arraysize(child_quad[0]), child_pass_id[0]),
784 test::Pass(child_quad[1], arraysize(child_quad[1]), child_pass_id[1])}; 824 test::Pass(child_quad[1], arraysize(child_quad[1]), child_pass_id[1])};
785 825
786 SubmitCompositorFrame(&factory_, surface_passes, arraysize(surface_passes), 826 SubmitCompositorFrame(&factory_, surface_passes, arraysize(surface_passes),
787 child_surface_id); 827 child_local_frame_id);
788 828
789 // Pass IDs from the parent surface may collide with ones from the child. 829 // Pass IDs from the parent surface may collide with ones from the child.
790 RenderPassId parent_pass_id[] = {RenderPassId(2, 1), RenderPassId(1, 2)}; 830 RenderPassId parent_pass_id[] = {RenderPassId(2, 1), RenderPassId(1, 2)};
791 test::Quad parent_quad[][1] = { 831 test::Quad parent_quad[][1] = {
792 {test::Quad::SurfaceQuad(child_surface_id, 1.f)}, 832 {test::Quad::SurfaceQuad(child_surface_id, 1.f)},
793 {test::Quad::RenderPassQuad(parent_pass_id[0])}}; 833 {test::Quad::RenderPassQuad(parent_pass_id[0])}};
794 test::Pass parent_passes[] = { 834 test::Pass parent_passes[] = {
795 test::Pass(parent_quad[0], arraysize(parent_quad[0]), parent_pass_id[0]), 835 test::Pass(parent_quad[0], arraysize(parent_quad[0]), parent_pass_id[0]),
796 test::Pass(parent_quad[1], arraysize(parent_quad[1]), parent_pass_id[1])}; 836 test::Pass(parent_quad[1], arraysize(parent_quad[1]), parent_pass_id[1])};
797 837
798 SubmitCompositorFrame(&factory_, parent_passes, arraysize(parent_passes), 838 SubmitCompositorFrame(&factory_, parent_passes, arraysize(parent_passes),
799 root_surface_id_); 839 root_local_frame_id_);
800 840
801 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 841 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
842 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
802 843
803 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 844 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
804 845
805 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 846 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
806 847
807 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 848 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
808 849
809 ASSERT_EQ(3u, aggregated_pass_list.size()); 850 ASSERT_EQ(3u, aggregated_pass_list.size());
810 RenderPassId actual_pass_ids[] = {aggregated_pass_list[0]->id, 851 RenderPassId actual_pass_ids[] = {aggregated_pass_list[0]->id,
811 aggregated_pass_list[1]->id, 852 aggregated_pass_list[1]->id,
(...skipping 11 matching lines...) Expand all
823 aggregated_pass_list[2]->quad_list.front()}; 864 aggregated_pass_list[2]->quad_list.front()};
824 ASSERT_EQ(render_pass_quads[0]->material, DrawQuad::RENDER_PASS); 865 ASSERT_EQ(render_pass_quads[0]->material, DrawQuad::RENDER_PASS);
825 EXPECT_EQ( 866 EXPECT_EQ(
826 actual_pass_ids[0], 867 actual_pass_ids[0],
827 RenderPassDrawQuad::MaterialCast(render_pass_quads[0])->render_pass_id); 868 RenderPassDrawQuad::MaterialCast(render_pass_quads[0])->render_pass_id);
828 869
829 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS); 870 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS);
830 EXPECT_EQ( 871 EXPECT_EQ(
831 actual_pass_ids[1], 872 actual_pass_ids[1],
832 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id); 873 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id);
833 factory_.Destroy(child_surface_id); 874 factory_.Destroy(child_local_frame_id);
834 } 875 }
835 876
836 void AddSolidColorQuadWithBlendMode(const gfx::Size& size, 877 void AddSolidColorQuadWithBlendMode(const gfx::Size& size,
837 RenderPass* pass, 878 RenderPass* pass,
838 const SkXfermode::Mode blend_mode) { 879 const SkXfermode::Mode blend_mode) {
839 const gfx::Transform layer_to_target_transform; 880 const gfx::Transform layer_to_target_transform;
840 const gfx::Size layer_bounds(size); 881 const gfx::Size layer_bounds(size);
841 const gfx::Rect visible_layer_rect(size); 882 const gfx::Rect visible_layer_rect(size);
842 const gfx::Rect clip_rect(size); 883 const gfx::Rect clip_rect(size);
843 884
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 const SkXfermode::Mode blend_modes[] = {SkXfermode::kClear_Mode, // 0 928 const SkXfermode::Mode blend_modes[] = {SkXfermode::kClear_Mode, // 0
888 SkXfermode::kSrc_Mode, // 1 929 SkXfermode::kSrc_Mode, // 1
889 SkXfermode::kDst_Mode, // 2 930 SkXfermode::kDst_Mode, // 2
890 SkXfermode::kSrcOver_Mode, // 3 931 SkXfermode::kSrcOver_Mode, // 3
891 SkXfermode::kDstOver_Mode, // 4 932 SkXfermode::kDstOver_Mode, // 4
892 SkXfermode::kSrcIn_Mode, // 5 933 SkXfermode::kSrcIn_Mode, // 5
893 SkXfermode::kDstIn_Mode, // 6 934 SkXfermode::kDstIn_Mode, // 6
894 }; 935 };
895 936
896 RenderPassId pass_id(1, 1); 937 RenderPassId pass_id(1, 1);
897 SurfaceId grandchild_surface_id = allocator_.GenerateId(); 938 LocalFrameId grandchild_local_frame_id = allocator_.GenerateId();
898 factory_.Create(grandchild_surface_id); 939 SurfaceId grandchild_surface_id(factory_.frame_sink_id(),
940 grandchild_local_frame_id);
941 factory_.Create(grandchild_local_frame_id);
899 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); 942 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create();
900 gfx::Rect output_rect(SurfaceSize()); 943 gfx::Rect output_rect(SurfaceSize());
901 gfx::Rect damage_rect(SurfaceSize()); 944 gfx::Rect damage_rect(SurfaceSize());
902 gfx::Transform transform_to_root_target; 945 gfx::Transform transform_to_root_target;
903 grandchild_pass->SetNew( 946 grandchild_pass->SetNew(
904 pass_id, output_rect, damage_rect, transform_to_root_target); 947 pass_id, output_rect, damage_rect, transform_to_root_target);
905 AddSolidColorQuadWithBlendMode( 948 AddSolidColorQuadWithBlendMode(
906 SurfaceSize(), grandchild_pass.get(), blend_modes[2]); 949 SurfaceSize(), grandchild_pass.get(), blend_modes[2]);
907 QueuePassAsFrame(std::move(grandchild_pass), grandchild_surface_id); 950 QueuePassAsFrame(std::move(grandchild_pass), grandchild_local_frame_id);
908 951
909 SurfaceId child_one_surface_id = allocator_.GenerateId(); 952 LocalFrameId child_one_local_frame_id = allocator_.GenerateId();
910 factory_.Create(child_one_surface_id); 953 SurfaceId child_one_surface_id(factory_.frame_sink_id(),
954 child_one_local_frame_id);
955 factory_.Create(child_one_local_frame_id);
911 956
912 std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create(); 957 std::unique_ptr<RenderPass> child_one_pass = RenderPass::Create();
913 child_one_pass->SetNew( 958 child_one_pass->SetNew(
914 pass_id, output_rect, damage_rect, transform_to_root_target); 959 pass_id, output_rect, damage_rect, transform_to_root_target);
915 AddSolidColorQuadWithBlendMode( 960 AddSolidColorQuadWithBlendMode(
916 SurfaceSize(), child_one_pass.get(), blend_modes[1]); 961 SurfaceSize(), child_one_pass.get(), blend_modes[1]);
917 SurfaceDrawQuad* grandchild_surface_quad = 962 SurfaceDrawQuad* grandchild_surface_quad =
918 child_one_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 963 child_one_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
919 grandchild_surface_quad->SetNew(child_one_pass->shared_quad_state_list.back(), 964 grandchild_surface_quad->SetNew(child_one_pass->shared_quad_state_list.back(),
920 gfx::Rect(SurfaceSize()), 965 gfx::Rect(SurfaceSize()),
921 gfx::Rect(SurfaceSize()), 966 gfx::Rect(SurfaceSize()),
922 grandchild_surface_id); 967 grandchild_surface_id);
923 AddSolidColorQuadWithBlendMode( 968 AddSolidColorQuadWithBlendMode(
924 SurfaceSize(), child_one_pass.get(), blend_modes[3]); 969 SurfaceSize(), child_one_pass.get(), blend_modes[3]);
925 QueuePassAsFrame(std::move(child_one_pass), child_one_surface_id); 970 QueuePassAsFrame(std::move(child_one_pass), child_one_local_frame_id);
926 971
927 SurfaceId child_two_surface_id = allocator_.GenerateId(); 972 LocalFrameId child_two_local_frame_id = allocator_.GenerateId();
928 factory_.Create(child_two_surface_id); 973 SurfaceId child_two_surface_id(factory_.frame_sink_id(),
974 child_two_local_frame_id);
975 factory_.Create(child_two_local_frame_id);
929 976
930 std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create(); 977 std::unique_ptr<RenderPass> child_two_pass = RenderPass::Create();
931 child_two_pass->SetNew( 978 child_two_pass->SetNew(
932 pass_id, output_rect, damage_rect, transform_to_root_target); 979 pass_id, output_rect, damage_rect, transform_to_root_target);
933 AddSolidColorQuadWithBlendMode( 980 AddSolidColorQuadWithBlendMode(
934 SurfaceSize(), child_two_pass.get(), blend_modes[5]); 981 SurfaceSize(), child_two_pass.get(), blend_modes[5]);
935 QueuePassAsFrame(std::move(child_two_pass), child_two_surface_id); 982 QueuePassAsFrame(std::move(child_two_pass), child_two_local_frame_id);
936 983
937 std::unique_ptr<RenderPass> root_pass = RenderPass::Create(); 984 std::unique_ptr<RenderPass> root_pass = RenderPass::Create();
938 root_pass->SetNew( 985 root_pass->SetNew(
939 pass_id, output_rect, damage_rect, transform_to_root_target); 986 pass_id, output_rect, damage_rect, transform_to_root_target);
940 987
941 AddSolidColorQuadWithBlendMode( 988 AddSolidColorQuadWithBlendMode(
942 SurfaceSize(), root_pass.get(), blend_modes[0]); 989 SurfaceSize(), root_pass.get(), blend_modes[0]);
943 SurfaceDrawQuad* child_one_surface_quad = 990 SurfaceDrawQuad* child_one_surface_quad =
944 root_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 991 root_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
945 child_one_surface_quad->SetNew(root_pass->shared_quad_state_list.back(), 992 child_one_surface_quad->SetNew(root_pass->shared_quad_state_list.back(),
946 gfx::Rect(SurfaceSize()), 993 gfx::Rect(SurfaceSize()),
947 gfx::Rect(SurfaceSize()), 994 gfx::Rect(SurfaceSize()),
948 child_one_surface_id); 995 child_one_surface_id);
949 AddSolidColorQuadWithBlendMode( 996 AddSolidColorQuadWithBlendMode(
950 SurfaceSize(), root_pass.get(), blend_modes[4]); 997 SurfaceSize(), root_pass.get(), blend_modes[4]);
951 SurfaceDrawQuad* child_two_surface_quad = 998 SurfaceDrawQuad* child_two_surface_quad =
952 root_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 999 root_pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
953 child_two_surface_quad->SetNew(root_pass->shared_quad_state_list.back(), 1000 child_two_surface_quad->SetNew(root_pass->shared_quad_state_list.back(),
954 gfx::Rect(SurfaceSize()), 1001 gfx::Rect(SurfaceSize()),
955 gfx::Rect(SurfaceSize()), 1002 gfx::Rect(SurfaceSize()),
956 child_two_surface_id); 1003 child_two_surface_id);
957 AddSolidColorQuadWithBlendMode( 1004 AddSolidColorQuadWithBlendMode(
958 SurfaceSize(), root_pass.get(), blend_modes[6]); 1005 SurfaceSize(), root_pass.get(), blend_modes[6]);
959 1006
960 QueuePassAsFrame(std::move(root_pass), root_surface_id_); 1007 QueuePassAsFrame(std::move(root_pass), root_local_frame_id_);
961 1008
962 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1009 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1010 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
963 1011
964 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1012 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
965 1013
966 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 1014 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
967 1015
968 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1016 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
969 1017
970 ASSERT_EQ(1u, aggregated_pass_list.size()); 1018 ASSERT_EQ(1u, aggregated_pass_list.size());
971 1019
972 const QuadList& aggregated_quad_list = aggregated_pass_list[0]->quad_list; 1020 const QuadList& aggregated_quad_list = aggregated_pass_list[0]->quad_list;
973 1021
974 ASSERT_EQ(7u, aggregated_quad_list.size()); 1022 ASSERT_EQ(7u, aggregated_quad_list.size());
975 1023
976 for (auto iter = aggregated_quad_list.cbegin(); 1024 for (auto iter = aggregated_quad_list.cbegin();
977 iter != aggregated_quad_list.cend(); 1025 iter != aggregated_quad_list.cend();
978 ++iter) { 1026 ++iter) {
979 EXPECT_EQ(blend_modes[iter.index()], iter->shared_quad_state->blend_mode) 1027 EXPECT_EQ(blend_modes[iter.index()], iter->shared_quad_state->blend_mode)
980 << iter.index(); 1028 << iter.index();
981 } 1029 }
982 factory_.Destroy(child_one_surface_id); 1030 factory_.Destroy(child_one_local_frame_id);
983 factory_.Destroy(child_two_surface_id); 1031 factory_.Destroy(child_two_local_frame_id);
984 factory_.Destroy(grandchild_surface_id); 1032 factory_.Destroy(grandchild_local_frame_id);
985 } 1033 }
986 1034
987 // This tests that when aggregating a frame with multiple render passes that we 1035 // This tests that when aggregating a frame with multiple render passes that we
988 // map the transforms for the root pass but do not modify the transform on child 1036 // map the transforms for the root pass but do not modify the transform on child
989 // passes. 1037 // passes.
990 // 1038 //
991 // The root surface has one pass with a surface quad transformed by +10 in the y 1039 // The root surface has one pass with a surface quad transformed by +10 in the y
992 // direction. 1040 // direction.
993 // 1041 //
994 // The middle surface has one pass with a surface quad scaled by 2 in the x 1042 // The middle surface has one pass with a surface quad scaled by 2 in the x
995 // and 3 in the y directions. 1043 // and 3 in the y directions.
996 // 1044 //
997 // The child surface has two passes. The first pass has a quad with a transform 1045 // The child surface has two passes. The first pass has a quad with a transform
998 // of +5 in the x direction. The second pass has a reference to the first pass' 1046 // of +5 in the x direction. The second pass has a reference to the first pass'
999 // pass id and a transform of +8 in the x direction. 1047 // pass id and a transform of +8 in the x direction.
1000 // 1048 //
1001 // After aggregation, the child surface's root pass quad should have all 1049 // After aggregation, the child surface's root pass quad should have all
1002 // transforms concatenated for a total transform of +23 x, +10 y. The 1050 // transforms concatenated for a total transform of +23 x, +10 y. The
1003 // contributing render pass' transform in the aggregate frame should not be 1051 // contributing render pass' transform in the aggregate frame should not be
1004 // affected. 1052 // affected.
1005 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) { 1053 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) {
1006 // Innermost child surface. 1054 // Innermost child surface.
1007 SurfaceId child_surface_id = allocator_.GenerateId(); 1055 LocalFrameId child_local_frame_id = allocator_.GenerateId();
1008 factory_.Create(child_surface_id); 1056 SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
1057 factory_.Create(child_local_frame_id);
1009 { 1058 {
1010 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)}; 1059 RenderPassId child_pass_id[] = {RenderPassId(1, 1), RenderPassId(1, 2)};
1011 test::Quad child_quads[][1] = { 1060 test::Quad child_quads[][1] = {
1012 {test::Quad::SolidColorQuad(SK_ColorGREEN)}, 1061 {test::Quad::SolidColorQuad(SK_ColorGREEN)},
1013 {test::Quad::RenderPassQuad(child_pass_id[0])}, 1062 {test::Quad::RenderPassQuad(child_pass_id[0])},
1014 }; 1063 };
1015 test::Pass child_passes[] = { 1064 test::Pass child_passes[] = {
1016 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]), 1065 test::Pass(child_quads[0], arraysize(child_quads[0]), child_pass_id[0]),
1017 test::Pass(child_quads[1], arraysize(child_quads[1]), 1066 test::Pass(child_quads[1], arraysize(child_quads[1]),
1018 child_pass_id[1])}; 1067 child_pass_id[1])};
(...skipping 15 matching lines...) Expand all
1034 child_root_pass_sqs->is_clipped = true; 1083 child_root_pass_sqs->is_clipped = true;
1035 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5); 1084 child_root_pass_sqs->clip_rect = gfx::Rect(0, 0, 5, 5);
1036 1085
1037 std::unique_ptr<DelegatedFrameData> child_frame_data( 1086 std::unique_ptr<DelegatedFrameData> child_frame_data(
1038 new DelegatedFrameData); 1087 new DelegatedFrameData);
1039 child_pass_list.swap(child_frame_data->render_pass_list); 1088 child_pass_list.swap(child_frame_data->render_pass_list);
1040 1089
1041 CompositorFrame child_frame; 1090 CompositorFrame child_frame;
1042 child_frame.delegated_frame_data = std::move(child_frame_data); 1091 child_frame.delegated_frame_data = std::move(child_frame_data);
1043 1092
1044 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), 1093 factory_.SubmitCompositorFrame(child_local_frame_id, std::move(child_frame),
1045 SurfaceFactory::DrawCallback()); 1094 SurfaceFactory::DrawCallback());
1046 } 1095 }
1047 1096
1048 // Middle child surface. 1097 // Middle child surface.
1049 SurfaceId middle_surface_id = allocator_.GenerateId(); 1098 LocalFrameId middle_local_frame_id = allocator_.GenerateId();
1050 factory_.Create(middle_surface_id); 1099 SurfaceId middle_surface_id(factory_.frame_sink_id(), middle_local_frame_id);
1100 factory_.Create(middle_local_frame_id);
1051 { 1101 {
1052 test::Quad middle_quads[] = { 1102 test::Quad middle_quads[] = {
1053 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1103 test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1054 test::Pass middle_passes[] = { 1104 test::Pass middle_passes[] = {
1055 test::Pass(middle_quads, arraysize(middle_quads)), 1105 test::Pass(middle_quads, arraysize(middle_quads)),
1056 }; 1106 };
1057 1107
1058 RenderPassList middle_pass_list; 1108 RenderPassList middle_pass_list;
1059 AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes, 1109 AddPasses(&middle_pass_list, gfx::Rect(SurfaceSize()), middle_passes,
1060 arraysize(middle_passes)); 1110 arraysize(middle_passes));
1061 1111
1062 RenderPass* middle_root_pass = middle_pass_list[0].get(); 1112 RenderPass* middle_root_pass = middle_pass_list[0].get();
1063 middle_root_pass->quad_list.ElementAt(0)->visible_rect = 1113 middle_root_pass->quad_list.ElementAt(0)->visible_rect =
1064 gfx::Rect(0, 1, 100, 7); 1114 gfx::Rect(0, 1, 100, 7);
1065 SharedQuadState* middle_root_pass_sqs = 1115 SharedQuadState* middle_root_pass_sqs =
1066 middle_root_pass->shared_quad_state_list.front(); 1116 middle_root_pass->shared_quad_state_list.front();
1067 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3); 1117 middle_root_pass_sqs->quad_to_target_transform.Scale(2, 3);
1068 1118
1069 std::unique_ptr<DelegatedFrameData> middle_frame_data( 1119 std::unique_ptr<DelegatedFrameData> middle_frame_data(
1070 new DelegatedFrameData); 1120 new DelegatedFrameData);
1071 middle_pass_list.swap(middle_frame_data->render_pass_list); 1121 middle_pass_list.swap(middle_frame_data->render_pass_list);
1072 1122
1073 CompositorFrame middle_frame; 1123 CompositorFrame middle_frame;
1074 middle_frame.delegated_frame_data = std::move(middle_frame_data); 1124 middle_frame.delegated_frame_data = std::move(middle_frame_data);
1075 1125
1076 factory_.SubmitCompositorFrame(middle_surface_id, std::move(middle_frame), 1126 factory_.SubmitCompositorFrame(middle_local_frame_id,
1127 std::move(middle_frame),
1077 SurfaceFactory::DrawCallback()); 1128 SurfaceFactory::DrawCallback());
1078 } 1129 }
1079 1130
1080 // Root surface. 1131 // Root surface.
1081 test::Quad secondary_quads[] = { 1132 test::Quad secondary_quads[] = {
1082 test::Quad::SolidColorQuad(1), 1133 test::Quad::SolidColorQuad(1),
1083 test::Quad::SurfaceQuad(middle_surface_id, 1.f)}; 1134 test::Quad::SurfaceQuad(middle_surface_id, 1.f)};
1084 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1)}; 1135 test::Quad root_quads[] = {test::Quad::SolidColorQuad(1)};
1085 test::Pass root_passes[] = { 1136 test::Pass root_passes[] = {
1086 test::Pass(secondary_quads, arraysize(secondary_quads)), 1137 test::Pass(secondary_quads, arraysize(secondary_quads)),
(...skipping 15 matching lines...) Expand all
1102 gfx::Rect(0, 0, 8, 100); 1153 gfx::Rect(0, 0, 8, 100);
1103 1154
1104 root_pass_list[0]->transform_to_root_target.Translate(10, 5); 1155 root_pass_list[0]->transform_to_root_target.Translate(10, 5);
1105 1156
1106 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1157 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1107 root_pass_list.swap(root_frame_data->render_pass_list); 1158 root_pass_list.swap(root_frame_data->render_pass_list);
1108 1159
1109 CompositorFrame root_frame; 1160 CompositorFrame root_frame;
1110 root_frame.delegated_frame_data = std::move(root_frame_data); 1161 root_frame.delegated_frame_data = std::move(root_frame_data);
1111 1162
1112 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), 1163 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(root_frame),
1113 SurfaceFactory::DrawCallback()); 1164 SurfaceFactory::DrawCallback());
1114 1165
1115 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1166 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1167 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1116 1168
1117 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1169 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1118 1170
1119 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 1171 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
1120 1172
1121 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1173 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1122 1174
1123 ASSERT_EQ(3u, aggregated_pass_list.size()); 1175 ASSERT_EQ(3u, aggregated_pass_list.size());
1124 1176
1125 ASSERT_EQ(1u, aggregated_pass_list[0]->shared_quad_state_list.size()); 1177 ASSERT_EQ(1u, aggregated_pass_list[0]->shared_quad_state_list.size());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 aggregated_pass_list[1]->shared_quad_state_list.ElementAt(1)->is_clipped); 1232 aggregated_pass_list[1]->shared_quad_state_list.ElementAt(1)->is_clipped);
1181 1233
1182 // The second quad in the root pass is aggregated from the child, so its 1234 // The second quad in the root pass is aggregated from the child, so its
1183 // clip rect must be transformed by the child's translation/scale and 1235 // clip rect must be transformed by the child's translation/scale and
1184 // clipped be the visible_rects for both children. 1236 // clipped be the visible_rects for both children.
1185 EXPECT_EQ(gfx::Rect(0, 13, 8, 12).ToString(), 1237 EXPECT_EQ(gfx::Rect(0, 13, 8, 12).ToString(),
1186 aggregated_pass_list[1] 1238 aggregated_pass_list[1]
1187 ->shared_quad_state_list.ElementAt(1) 1239 ->shared_quad_state_list.ElementAt(1)
1188 ->clip_rect.ToString()); 1240 ->clip_rect.ToString());
1189 1241
1190 factory_.Destroy(middle_surface_id); 1242 factory_.Destroy(middle_local_frame_id);
1191 factory_.Destroy(child_surface_id); 1243 factory_.Destroy(child_local_frame_id);
1192 } 1244 }
1193 1245
1194 // Tests that damage rects are aggregated correctly when surfaces change. 1246 // Tests that damage rects are aggregated correctly when surfaces change.
1195 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { 1247 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) {
1196 test::Quad child_quads[] = {test::Quad::RenderPassQuad(RenderPassId(1, 1))}; 1248 test::Quad child_quads[] = {test::Quad::RenderPassQuad(RenderPassId(1, 1))};
1197 test::Pass child_passes[] = { 1249 test::Pass child_passes[] = {
1198 test::Pass(child_quads, arraysize(child_quads), RenderPassId(1, 1))}; 1250 test::Pass(child_quads, arraysize(child_quads), RenderPassId(1, 1))};
1199 1251
1200 RenderPassList child_pass_list; 1252 RenderPassList child_pass_list;
1201 AddPasses(&child_pass_list, 1253 AddPasses(&child_pass_list,
1202 gfx::Rect(SurfaceSize()), 1254 gfx::Rect(SurfaceSize()),
1203 child_passes, 1255 child_passes,
1204 arraysize(child_passes)); 1256 arraysize(child_passes));
1205 1257
1206 RenderPass* child_root_pass = child_pass_list[0].get(); 1258 RenderPass* child_root_pass = child_pass_list[0].get();
1207 SharedQuadState* child_root_pass_sqs = 1259 SharedQuadState* child_root_pass_sqs =
1208 child_root_pass->shared_quad_state_list.front(); 1260 child_root_pass->shared_quad_state_list.front();
1209 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); 1261 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
1210 1262
1211 std::unique_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData); 1263 std::unique_ptr<DelegatedFrameData> child_frame_data(new DelegatedFrameData);
1212 child_pass_list.swap(child_frame_data->render_pass_list); 1264 child_pass_list.swap(child_frame_data->render_pass_list);
1213 1265
1214 CompositorFrame child_frame; 1266 CompositorFrame child_frame;
1215 child_frame.delegated_frame_data = std::move(child_frame_data); 1267 child_frame.delegated_frame_data = std::move(child_frame_data);
1216 1268
1217 SurfaceId child_surface_id = allocator_.GenerateId(); 1269 LocalFrameId child_local_frame_id = allocator_.GenerateId();
1218 factory_.Create(child_surface_id); 1270 SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
1219 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), 1271 factory_.Create(child_local_frame_id);
1272 factory_.SubmitCompositorFrame(child_local_frame_id, std::move(child_frame),
1220 SurfaceFactory::DrawCallback()); 1273 SurfaceFactory::DrawCallback());
1221 1274
1222 test::Quad parent_surface_quads[] = { 1275 test::Quad parent_surface_quads[] = {
1223 test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1276 test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1224 test::Pass parent_surface_passes[] = { 1277 test::Pass parent_surface_passes[] = {
1225 test::Pass(parent_surface_quads, arraysize(parent_surface_quads), 1278 test::Pass(parent_surface_quads, arraysize(parent_surface_quads),
1226 RenderPassId(1, 1))}; 1279 RenderPassId(1, 1))};
1227 1280
1228 RenderPassList parent_surface_pass_list; 1281 RenderPassList parent_surface_pass_list;
1229 AddPasses(&parent_surface_pass_list, 1282 AddPasses(&parent_surface_pass_list,
1230 gfx::Rect(SurfaceSize()), 1283 gfx::Rect(SurfaceSize()),
1231 parent_surface_passes, 1284 parent_surface_passes,
1232 arraysize(parent_surface_passes)); 1285 arraysize(parent_surface_passes));
1233 1286
1234 // Parent surface is only used to test if the transform is applied correctly 1287 // Parent surface is only used to test if the transform is applied correctly
1235 // to the child surface's damage. 1288 // to the child surface's damage.
1236 std::unique_ptr<DelegatedFrameData> parent_surface_frame_data( 1289 std::unique_ptr<DelegatedFrameData> parent_surface_frame_data(
1237 new DelegatedFrameData); 1290 new DelegatedFrameData);
1238 parent_surface_pass_list.swap(parent_surface_frame_data->render_pass_list); 1291 parent_surface_pass_list.swap(parent_surface_frame_data->render_pass_list);
1239 1292
1240 CompositorFrame parent_surface_frame; 1293 CompositorFrame parent_surface_frame;
1241 parent_surface_frame.delegated_frame_data = 1294 parent_surface_frame.delegated_frame_data =
1242 std::move(parent_surface_frame_data); 1295 std::move(parent_surface_frame_data);
1243 1296
1244 SurfaceId parent_surface_id = allocator_.GenerateId(); 1297 LocalFrameId parent_local_frame_id = allocator_.GenerateId();
1245 factory_.Create(parent_surface_id); 1298 SurfaceId parent_surface_id(factory_.frame_sink_id(), parent_local_frame_id);
1246 factory_.SubmitCompositorFrame(parent_surface_id, 1299 factory_.Create(parent_local_frame_id);
1300 factory_.SubmitCompositorFrame(parent_local_frame_id,
1247 std::move(parent_surface_frame), 1301 std::move(parent_surface_frame),
1248 SurfaceFactory::DrawCallback()); 1302 SurfaceFactory::DrawCallback());
1249 1303
1250 test::Quad root_surface_quads[] = { 1304 test::Quad root_surface_quads[] = {
1251 test::Quad::SurfaceQuad(parent_surface_id, 1.f)}; 1305 test::Quad::SurfaceQuad(parent_surface_id, 1.f)};
1252 test::Quad root_render_pass_quads[] = { 1306 test::Quad root_render_pass_quads[] = {
1253 test::Quad::RenderPassQuad(RenderPassId(1, 1))}; 1307 test::Quad::RenderPassQuad(RenderPassId(1, 1))};
1254 1308
1255 test::Pass root_passes[] = { 1309 test::Pass root_passes[] = {
1256 test::Pass(root_surface_quads, arraysize(root_surface_quads), 1310 test::Pass(root_surface_quads, arraysize(root_surface_quads),
(...skipping 12 matching lines...) Expand all
1269 ->quad_to_target_transform.Translate(0, 10); 1323 ->quad_to_target_transform.Translate(0, 10);
1270 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10); 1324 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 10, 10);
1271 root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100); 1325 root_pass_list[1]->damage_rect = gfx::Rect(5, 5, 100, 100);
1272 1326
1273 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1327 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1274 root_pass_list.swap(root_frame_data->render_pass_list); 1328 root_pass_list.swap(root_frame_data->render_pass_list);
1275 1329
1276 CompositorFrame root_frame; 1330 CompositorFrame root_frame;
1277 root_frame.delegated_frame_data = std::move(root_frame_data); 1331 root_frame.delegated_frame_data = std::move(root_frame_data);
1278 1332
1279 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), 1333 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(root_frame),
1280 SurfaceFactory::DrawCallback()); 1334 SurfaceFactory::DrawCallback());
1281 1335
1282 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1336 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1337 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1283 1338
1284 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1339 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1285 1340
1286 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 1341 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
1287 1342
1288 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1343 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1289 1344
1290 ASSERT_EQ(2u, aggregated_pass_list.size()); 1345 ASSERT_EQ(2u, aggregated_pass_list.size());
1291 1346
1292 // Damage rect for first aggregation should contain entire root surface. 1347 // Damage rect for first aggregation should contain entire root surface.
(...skipping 12 matching lines...) Expand all
1305 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0); 1360 child_root_pass_sqs->quad_to_target_transform.Translate(8, 0);
1306 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10); 1361 child_root_pass->damage_rect = gfx::Rect(10, 10, 10, 10);
1307 1362
1308 std::unique_ptr<DelegatedFrameData> child_frame_data( 1363 std::unique_ptr<DelegatedFrameData> child_frame_data(
1309 new DelegatedFrameData); 1364 new DelegatedFrameData);
1310 child_pass_list.swap(child_frame_data->render_pass_list); 1365 child_pass_list.swap(child_frame_data->render_pass_list);
1311 1366
1312 CompositorFrame child_frame; 1367 CompositorFrame child_frame;
1313 child_frame.delegated_frame_data = std::move(child_frame_data); 1368 child_frame.delegated_frame_data = std::move(child_frame_data);
1314 1369
1315 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), 1370 factory_.SubmitCompositorFrame(child_local_frame_id, std::move(child_frame),
1316 SurfaceFactory::DrawCallback()); 1371 SurfaceFactory::DrawCallback());
1317 1372
1318 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1373 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1374 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1319 1375
1320 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1376 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1321 1377
1322 DelegatedFrameData* frame_data = 1378 DelegatedFrameData* frame_data =
1323 aggregated_frame.delegated_frame_data.get(); 1379 aggregated_frame.delegated_frame_data.get();
1324 1380
1325 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1381 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1326 1382
1327 ASSERT_EQ(2u, aggregated_pass_list.size()); 1383 ASSERT_EQ(2u, aggregated_pass_list.size());
1328 1384
(...skipping 14 matching lines...) Expand all
1343 ->shared_quad_state_list.front() 1399 ->shared_quad_state_list.front()
1344 ->quad_to_target_transform.Translate(0, 10); 1400 ->quad_to_target_transform.Translate(0, 10);
1345 root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1); 1401 root_pass_list[0]->damage_rect = gfx::Rect(0, 0, 1, 1);
1346 1402
1347 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1403 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1348 root_pass_list.swap(root_frame_data->render_pass_list); 1404 root_pass_list.swap(root_frame_data->render_pass_list);
1349 1405
1350 CompositorFrame root_frame; 1406 CompositorFrame root_frame;
1351 root_frame.delegated_frame_data = std::move(root_frame_data); 1407 root_frame.delegated_frame_data = std::move(root_frame_data);
1352 1408
1353 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), 1409 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(root_frame),
1354 SurfaceFactory::DrawCallback()); 1410 SurfaceFactory::DrawCallback());
1355 } 1411 }
1356 1412
1357 { 1413 {
1358 RenderPassList root_pass_list; 1414 RenderPassList root_pass_list;
1359 AddPasses(&root_pass_list, 1415 AddPasses(&root_pass_list,
1360 gfx::Rect(SurfaceSize()), 1416 gfx::Rect(SurfaceSize()),
1361 root_passes, 1417 root_passes,
1362 arraysize(root_passes)); 1418 arraysize(root_passes));
1363 1419
1364 root_pass_list[0] 1420 root_pass_list[0]
1365 ->shared_quad_state_list.front() 1421 ->shared_quad_state_list.front()
1366 ->quad_to_target_transform.Translate(0, 10); 1422 ->quad_to_target_transform.Translate(0, 10);
1367 root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1); 1423 root_pass_list[0]->damage_rect = gfx::Rect(1, 1, 1, 1);
1368 1424
1369 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1425 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1370 root_pass_list.swap(root_frame_data->render_pass_list); 1426 root_pass_list.swap(root_frame_data->render_pass_list);
1371 1427
1372 CompositorFrame root_frame; 1428 CompositorFrame root_frame;
1373 root_frame.delegated_frame_data = std::move(root_frame_data); 1429 root_frame.delegated_frame_data = std::move(root_frame_data);
1374 1430
1375 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), 1431 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(root_frame),
1376 SurfaceFactory::DrawCallback()); 1432 SurfaceFactory::DrawCallback());
1377 1433
1378 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1434 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1435 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1379 1436
1380 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1437 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1381 1438
1382 DelegatedFrameData* frame_data = 1439 DelegatedFrameData* frame_data =
1383 aggregated_frame.delegated_frame_data.get(); 1440 aggregated_frame.delegated_frame_data.get();
1384 1441
1385 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1442 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1386 1443
1387 ASSERT_EQ(2u, aggregated_pass_list.size()); 1444 ASSERT_EQ(2u, aggregated_pass_list.size());
1388 1445
1389 // The root surface was enqueued without being aggregated once, so it should 1446 // The root surface was enqueued without being aggregated once, so it should
1390 // be treated as completely damaged. 1447 // be treated as completely damaged.
1391 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.Contains( 1448 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.Contains(
1392 gfx::Rect(SurfaceSize()))); 1449 gfx::Rect(SurfaceSize())));
1393 } 1450 }
1394 1451
1395 // No Surface changed, so no damage should be given. 1452 // No Surface changed, so no damage should be given.
1396 { 1453 {
1397 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1454 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1455 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1398 1456
1399 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1457 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1400 1458
1401 DelegatedFrameData* frame_data = 1459 DelegatedFrameData* frame_data =
1402 aggregated_frame.delegated_frame_data.get(); 1460 aggregated_frame.delegated_frame_data.get();
1403 1461
1404 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1462 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1405 1463
1406 ASSERT_EQ(2u, aggregated_pass_list.size()); 1464 ASSERT_EQ(2u, aggregated_pass_list.size());
1407 1465
1408 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.IsEmpty()); 1466 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.IsEmpty());
1409 } 1467 }
1410 1468
1411 // SetFullDamageRectForSurface should cause the entire output to be 1469 // SetFullDamageRectForSurface should cause the entire output to be
1412 // marked as damaged. 1470 // marked as damaged.
1413 { 1471 {
1414 aggregator_.SetFullDamageForSurface(root_surface_id_); 1472 aggregator_.SetFullDamageForSurface(root_surface_id);
1415 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1473 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1416 1474
1417 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1475 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1418 1476
1419 DelegatedFrameData* frame_data = 1477 DelegatedFrameData* frame_data =
1420 aggregated_frame.delegated_frame_data.get(); 1478 aggregated_frame.delegated_frame_data.get();
1421 1479
1422 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1480 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1423 1481
1424 ASSERT_EQ(2u, aggregated_pass_list.size()); 1482 ASSERT_EQ(2u, aggregated_pass_list.size());
1425 1483
1426 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.Contains( 1484 EXPECT_TRUE(aggregated_pass_list[1]->damage_rect.Contains(
1427 gfx::Rect(SurfaceSize()))); 1485 gfx::Rect(SurfaceSize())));
1428 } 1486 }
1429 1487
1430 factory_.Destroy(child_surface_id); 1488 factory_.Destroy(child_local_frame_id);
1431 } 1489 }
1432 1490
1433 // Check that damage is correctly calculated for surfaces with 1491 // Check that damage is correctly calculated for surfaces with
1434 // SetPreviousFrameSurface. 1492 // SetPreviousFrameSurface.
1435 TEST_F(SurfaceAggregatorValidSurfaceTest, SwitchSurfaceDamage) { 1493 TEST_F(SurfaceAggregatorValidSurfaceTest, SwitchSurfaceDamage) {
1436 test::Quad root_render_pass_quads[] = {test::Quad::SolidColorQuad(1)}; 1494 test::Quad root_render_pass_quads[] = {test::Quad::SolidColorQuad(1)};
1437 1495
1438 test::Pass root_passes[] = {test::Pass(root_render_pass_quads, 1496 test::Pass root_passes[] = {test::Pass(root_render_pass_quads,
1439 arraysize(root_render_pass_quads), 1497 arraysize(root_render_pass_quads),
1440 RenderPassId(2, 1))}; 1498 RenderPassId(2, 1))};
1441 1499
1442 RenderPassList root_pass_list; 1500 RenderPassList root_pass_list;
1443 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1501 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1444 arraysize(root_passes)); 1502 arraysize(root_passes));
1445 1503
1446 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 100, 100); 1504 root_pass_list[0]->damage_rect = gfx::Rect(5, 5, 100, 100);
1447 1505
1448 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1506 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1449 root_pass_list.swap(root_frame_data->render_pass_list); 1507 root_pass_list.swap(root_frame_data->render_pass_list);
1450 1508
1451 CompositorFrame root_frame; 1509 CompositorFrame root_frame;
1452 root_frame.delegated_frame_data = std::move(root_frame_data); 1510 root_frame.delegated_frame_data = std::move(root_frame_data);
1453 1511
1454 factory_.SubmitCompositorFrame(root_surface_id_, std::move(root_frame), 1512 factory_.SubmitCompositorFrame(root_local_frame_id_, std::move(root_frame),
1455 SurfaceFactory::DrawCallback()); 1513 SurfaceFactory::DrawCallback());
1456 1514
1457 { 1515 {
1458 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1516 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1517 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1459 1518
1460 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1519 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1461 1520
1462 DelegatedFrameData* frame_data = 1521 DelegatedFrameData* frame_data =
1463 aggregated_frame.delegated_frame_data.get(); 1522 aggregated_frame.delegated_frame_data.get();
1464 1523
1465 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1524 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1466 1525
1467 ASSERT_EQ(1u, aggregated_pass_list.size()); 1526 ASSERT_EQ(1u, aggregated_pass_list.size());
1468 1527
1469 // Damage rect for first aggregation should contain entire root surface. 1528 // Damage rect for first aggregation should contain entire root surface.
1470 EXPECT_TRUE(aggregated_pass_list[0]->damage_rect.Contains( 1529 EXPECT_TRUE(aggregated_pass_list[0]->damage_rect.Contains(
1471 gfx::Rect(SurfaceSize()))); 1530 gfx::Rect(SurfaceSize())));
1472 } 1531 }
1473 1532
1474 SurfaceId second_root_surface_id = allocator_.GenerateId(); 1533 LocalFrameId second_root_local_frame_id = allocator_.GenerateId();
1534 SurfaceId second_root_surface_id(factory_.frame_sink_id(),
1535 second_root_local_frame_id);
1475 { 1536 {
1476 test::Quad root_render_pass_quads[] = {test::Quad::SolidColorQuad(1)}; 1537 test::Quad root_render_pass_quads[] = {test::Quad::SolidColorQuad(1)};
1477 1538
1478 test::Pass root_passes[] = {test::Pass(root_render_pass_quads, 1539 test::Pass root_passes[] = {test::Pass(root_render_pass_quads,
1479 arraysize(root_render_pass_quads), 1540 arraysize(root_render_pass_quads),
1480 RenderPassId(2, 1))}; 1541 RenderPassId(2, 1))};
1481 1542
1482 RenderPassList root_pass_list; 1543 RenderPassList root_pass_list;
1483 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1544 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1484 arraysize(root_passes)); 1545 arraysize(root_passes));
1485 1546
1486 root_pass_list[0]->damage_rect = gfx::Rect(1, 2, 3, 4); 1547 root_pass_list[0]->damage_rect = gfx::Rect(1, 2, 3, 4);
1487 1548
1488 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData); 1549 std::unique_ptr<DelegatedFrameData> root_frame_data(new DelegatedFrameData);
1489 root_pass_list.swap(root_frame_data->render_pass_list); 1550 root_pass_list.swap(root_frame_data->render_pass_list);
1490 1551
1491 CompositorFrame root_frame; 1552 CompositorFrame root_frame;
1492 root_frame.delegated_frame_data = std::move(root_frame_data); 1553 root_frame.delegated_frame_data = std::move(root_frame_data);
1493 1554
1494 factory_.Create(second_root_surface_id); 1555 factory_.Create(second_root_local_frame_id);
1495 factory_.SubmitCompositorFrame(second_root_surface_id, 1556 factory_.SubmitCompositorFrame(second_root_local_frame_id,
1496 std::move(root_frame), 1557 std::move(root_frame),
1497 SurfaceFactory::DrawCallback()); 1558 SurfaceFactory::DrawCallback());
1498 factory_.SetPreviousFrameSurface(second_root_surface_id, root_surface_id_); 1559 factory_.SetPreviousFrameSurface(second_root_local_frame_id,
1560 root_local_frame_id_);
1499 } 1561 }
1500 { 1562 {
1501 CompositorFrame aggregated_frame = 1563 CompositorFrame aggregated_frame =
1502 aggregator_.Aggregate(second_root_surface_id); 1564 aggregator_.Aggregate(second_root_surface_id);
1503 1565
1504 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1566 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1505 1567
1506 DelegatedFrameData* frame_data = 1568 DelegatedFrameData* frame_data =
1507 aggregated_frame.delegated_frame_data.get(); 1569 aggregated_frame.delegated_frame_data.get();
1508 1570
(...skipping 14 matching lines...) Expand all
1523 DelegatedFrameData* frame_data = 1585 DelegatedFrameData* frame_data =
1524 aggregated_frame.delegated_frame_data.get(); 1586 aggregated_frame.delegated_frame_data.get();
1525 1587
1526 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1588 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1527 1589
1528 ASSERT_EQ(1u, aggregated_pass_list.size()); 1590 ASSERT_EQ(1u, aggregated_pass_list.size());
1529 1591
1530 // No new frame, so no new damage. 1592 // No new frame, so no new damage.
1531 EXPECT_TRUE(aggregated_pass_list[0]->damage_rect.IsEmpty()); 1593 EXPECT_TRUE(aggregated_pass_list[0]->damage_rect.IsEmpty());
1532 } 1594 }
1533 factory_.Destroy(second_root_surface_id); 1595 factory_.Destroy(second_root_local_frame_id);
1534 } 1596 }
1535 1597
1536 class SurfaceAggregatorPartialSwapTest 1598 class SurfaceAggregatorPartialSwapTest
1537 : public SurfaceAggregatorValidSurfaceTest { 1599 : public SurfaceAggregatorValidSurfaceTest {
1538 public: 1600 public:
1539 SurfaceAggregatorPartialSwapTest() 1601 SurfaceAggregatorPartialSwapTest()
1540 : SurfaceAggregatorValidSurfaceTest(true) {} 1602 : SurfaceAggregatorValidSurfaceTest(true) {}
1541 }; 1603 };
1542 1604
1543 // Tests that quads outside the damage rect are ignored. 1605 // Tests that quads outside the damage rect are ignored.
1544 TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) { 1606 TEST_F(SurfaceAggregatorPartialSwapTest, IgnoreOutside) {
1545 SurfaceId child_surface_id = allocator_.GenerateId(); 1607 LocalFrameId child_local_frame_id = allocator_.GenerateId();
1546 factory_.Create(child_surface_id); 1608 SurfaceId child_surface_id(factory_.frame_sink_id(), child_local_frame_id);
1609 factory_.Create(child_local_frame_id);
1547 // The child surface has three quads, one with a visible rect of 13,13 4x4 and 1610 // The child surface has three quads, one with a visible rect of 13,13 4x4 and
1548 // the other other with a visible rect of 10,10 2x2 (relative to root target 1611 // the other other with a visible rect of 10,10 2x2 (relative to root target
1549 // space), and one with a non-invertible transform. 1612 // space), and one with a non-invertible transform.
1550 { 1613 {
1551 RenderPassId child_pass_id = RenderPassId(1, 1); 1614 RenderPassId child_pass_id = RenderPassId(1, 1);
1552 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1615 test::Quad child_quads1[] = {test::Quad::RenderPassQuad(child_pass_id)};
1553 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1616 test::Quad child_quads2[] = {test::Quad::RenderPassQuad(child_pass_id)};
1554 test::Quad child_quads3[] = {test::Quad::RenderPassQuad(child_pass_id)}; 1617 test::Quad child_quads3[] = {test::Quad::RenderPassQuad(child_pass_id)};
1555 test::Pass child_passes[] = { 1618 test::Pass child_passes[] = {
1556 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id), 1619 test::Pass(child_quads1, arraysize(child_quads1), child_pass_id),
(...skipping 16 matching lines...) Expand all
1573 1636
1574 SharedQuadState* child_noninvertible_sqs = 1637 SharedQuadState* child_noninvertible_sqs =
1575 child_pass_list[2]->shared_quad_state_list.ElementAt(0u); 1638 child_pass_list[2]->shared_quad_state_list.ElementAt(0u);
1576 child_noninvertible_sqs->quad_to_target_transform.matrix().setDouble(0, 0, 1639 child_noninvertible_sqs->quad_to_target_transform.matrix().setDouble(0, 0,
1577 0.0); 1640 0.0);
1578 EXPECT_FALSE( 1641 EXPECT_FALSE(
1579 child_noninvertible_sqs->quad_to_target_transform.IsInvertible()); 1642 child_noninvertible_sqs->quad_to_target_transform.IsInvertible());
1580 child_pass_list[2]->quad_list.ElementAt(0)->visible_rect = 1643 child_pass_list[2]->quad_list.ElementAt(0)->visible_rect =
1581 gfx::Rect(0, 0, 2, 2); 1644 gfx::Rect(0, 0, 2, 2);
1582 1645
1583 SubmitPassListAsFrame(&factory_, child_surface_id, &child_pass_list); 1646 SubmitPassListAsFrame(&factory_, child_local_frame_id, &child_pass_list);
1584 } 1647 }
1585 1648
1586 { 1649 {
1587 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1650 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1588 1651
1589 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 1652 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
1590 1653
1591 RenderPassList root_pass_list; 1654 RenderPassList root_pass_list;
1592 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1655 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1593 arraysize(root_passes)); 1656 arraysize(root_passes));
1594 1657
1595 RenderPass* root_pass = root_pass_list[0].get(); 1658 RenderPass* root_pass = root_pass_list[0].get();
1596 root_pass->shared_quad_state_list.front() 1659 root_pass->shared_quad_state_list.front()
1597 ->quad_to_target_transform.Translate(10, 10); 1660 ->quad_to_target_transform.Translate(10, 10);
1598 root_pass->damage_rect = gfx::Rect(0, 0, 1, 1); 1661 root_pass->damage_rect = gfx::Rect(0, 0, 1, 1);
1599 1662
1600 SubmitPassListAsFrame(&factory_, root_surface_id_, &root_pass_list); 1663 SubmitPassListAsFrame(&factory_, root_local_frame_id_, &root_pass_list);
1601 } 1664 }
1602 1665
1603 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1666 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
1667 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1604 1668
1605 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1669 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1606 1670
1607 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get(); 1671 DelegatedFrameData* frame_data = aggregated_frame.delegated_frame_data.get();
1608 1672
1609 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1673 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1610 1674
1611 ASSERT_EQ(3u, aggregated_pass_list.size()); 1675 ASSERT_EQ(3u, aggregated_pass_list.size());
1612 1676
1613 // Damage rect for first aggregation should contain entire root surface. 1677 // Damage rect for first aggregation should contain entire root surface.
1614 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[2]->damage_rect); 1678 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[2]->damage_rect);
1615 EXPECT_EQ(1u, aggregated_pass_list[0]->quad_list.size()); 1679 EXPECT_EQ(1u, aggregated_pass_list[0]->quad_list.size());
1616 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1680 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1617 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size()); 1681 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1618 1682
1619 // Create a root surface with a smaller damage rect. 1683 // Create a root surface with a smaller damage rect.
1620 { 1684 {
1621 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)}; 1685 test::Quad root_quads[] = {test::Quad::SurfaceQuad(child_surface_id, 1.f)};
1622 1686
1623 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; 1687 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
1624 1688
1625 RenderPassList root_pass_list; 1689 RenderPassList root_pass_list;
1626 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1690 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1627 arraysize(root_passes)); 1691 arraysize(root_passes));
1628 1692
1629 RenderPass* root_pass = root_pass_list[0].get(); 1693 RenderPass* root_pass = root_pass_list[0].get();
1630 root_pass->shared_quad_state_list.front() 1694 root_pass->shared_quad_state_list.front()
1631 ->quad_to_target_transform.Translate(10, 10); 1695 ->quad_to_target_transform.Translate(10, 10);
1632 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2); 1696 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2);
1633 SubmitPassListAsFrame(&factory_, root_surface_id_, &root_pass_list); 1697 SubmitPassListAsFrame(&factory_, root_local_frame_id_, &root_pass_list);
1634 } 1698 }
1635 1699
1636 { 1700 {
1637 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1701 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1638 1702
1639 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1703 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1640 1704
1641 DelegatedFrameData* frame_data = 1705 DelegatedFrameData* frame_data =
1642 aggregated_frame.delegated_frame_data.get(); 1706 aggregated_frame.delegated_frame_data.get();
1643 1707
1644 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1708 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1645 1709
1646 ASSERT_EQ(3u, aggregated_pass_list.size()); 1710 ASSERT_EQ(3u, aggregated_pass_list.size());
1647 1711
(...skipping 29 matching lines...) Expand all
1677 child_sqs->quad_to_target_transform.Scale(2, 2); 1741 child_sqs->quad_to_target_transform.Scale(2, 2);
1678 1742
1679 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect = 1743 child_pass_list[1]->quad_list.ElementAt(0)->visible_rect =
1680 gfx::Rect(0, 0, 2, 2); 1744 gfx::Rect(0, 0, 2, 2);
1681 1745
1682 RenderPass* child_root_pass = child_pass_list[1].get(); 1746 RenderPass* child_root_pass = child_pass_list[1].get();
1683 1747
1684 child_root_pass->copy_requests.push_back( 1748 child_root_pass->copy_requests.push_back(
1685 CopyOutputRequest::CreateEmptyRequest()); 1749 CopyOutputRequest::CreateEmptyRequest());
1686 child_root_pass->damage_rect = gfx::Rect(); 1750 child_root_pass->damage_rect = gfx::Rect();
1687 SubmitPassListAsFrame(&factory_, child_surface_id, &child_pass_list); 1751 SubmitPassListAsFrame(&factory_, child_local_frame_id, &child_pass_list);
1688 } 1752 }
1689 1753
1690 { 1754 {
1691 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1755 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1692 1756
1693 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1757 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1694 1758
1695 DelegatedFrameData* frame_data = 1759 DelegatedFrameData* frame_data =
1696 aggregated_frame.delegated_frame_data.get(); 1760 aggregated_frame.delegated_frame_data.get();
1697 1761
1698 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1762 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1699 1763
1700 // Output frame should have no damage, but all quads included. 1764 // Output frame should have no damage, but all quads included.
1701 ASSERT_EQ(3u, aggregated_pass_list.size()); 1765 ASSERT_EQ(3u, aggregated_pass_list.size());
1702 1766
1703 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[0]->damage_rect); 1767 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[0]->damage_rect);
1704 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[1]->damage_rect); 1768 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[1]->damage_rect);
1705 EXPECT_TRUE(aggregated_pass_list[2]->damage_rect.IsEmpty()); 1769 EXPECT_TRUE(aggregated_pass_list[2]->damage_rect.IsEmpty());
1706 ASSERT_EQ(1u, aggregated_pass_list[0]->quad_list.size()); 1770 ASSERT_EQ(1u, aggregated_pass_list[0]->quad_list.size());
1707 ASSERT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1771 ASSERT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1708 EXPECT_EQ(gfx::Rect(1, 1, 2, 2), 1772 EXPECT_EQ(gfx::Rect(1, 1, 2, 2),
1709 aggregated_pass_list[0]->quad_list.ElementAt(0)->visible_rect); 1773 aggregated_pass_list[0]->quad_list.ElementAt(0)->visible_rect);
1710 EXPECT_EQ(gfx::Rect(0, 0, 2, 2), 1774 EXPECT_EQ(gfx::Rect(0, 0, 2, 2),
1711 aggregated_pass_list[1]->quad_list.ElementAt(0)->visible_rect); 1775 aggregated_pass_list[1]->quad_list.ElementAt(0)->visible_rect);
1712 ASSERT_EQ(1u, aggregated_pass_list[2]->quad_list.size()); 1776 ASSERT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1713 } 1777 }
1714 1778
1715 { 1779 {
1716 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1780 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1717 1781
1718 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1782 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1719 1783
1720 DelegatedFrameData* frame_data = 1784 DelegatedFrameData* frame_data =
1721 aggregated_frame.delegated_frame_data.get(); 1785 aggregated_frame.delegated_frame_data.get();
1722 1786
1723 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1787 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1724 // There were no changes since last aggregation, so output should be empty 1788 // There were no changes since last aggregation, so output should be empty
1725 // and have no damage. 1789 // and have no damage.
1726 ASSERT_EQ(1u, aggregated_pass_list.size()); 1790 ASSERT_EQ(1u, aggregated_pass_list.size());
(...skipping 16 matching lines...) Expand all
1743 arraysize(root_passes)); 1807 arraysize(root_passes));
1744 1808
1745 RenderPass* pass = root_pass_list[0].get(); 1809 RenderPass* pass = root_pass_list[0].get();
1746 pass->shared_quad_state_list.front()->quad_to_target_transform.Translate( 1810 pass->shared_quad_state_list.front()->quad_to_target_transform.Translate(
1747 10, 10); 1811 10, 10);
1748 RenderPass* root_pass = root_pass_list[1].get(); 1812 RenderPass* root_pass = root_pass_list[1].get();
1749 RenderPassDrawQuad* quad = 1813 RenderPassDrawQuad* quad =
1750 static_cast<RenderPassDrawQuad*>(root_pass->quad_list.front()); 1814 static_cast<RenderPassDrawQuad*>(root_pass->quad_list.front());
1751 quad->filters.Append(FilterOperation::CreateBlurFilter(2)); 1815 quad->filters.Append(FilterOperation::CreateBlurFilter(2));
1752 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2); 1816 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2);
1753 SubmitPassListAsFrame(&factory_, root_surface_id_, &root_pass_list); 1817 SubmitPassListAsFrame(&factory_, root_local_frame_id_, &root_pass_list);
1754 } 1818 }
1755 1819
1756 { 1820 {
1757 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1821 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1758 1822
1759 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1823 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1760 1824
1761 DelegatedFrameData* frame_data = 1825 DelegatedFrameData* frame_data =
1762 aggregated_frame.delegated_frame_data.get(); 1826 aggregated_frame.delegated_frame_data.get();
1763 1827
1764 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1828 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1765 1829
1766 ASSERT_EQ(3u, aggregated_pass_list.size()); 1830 ASSERT_EQ(3u, aggregated_pass_list.size());
1767 1831
(...skipping 25 matching lines...) Expand all
1793 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes, 1857 AddPasses(&root_pass_list, gfx::Rect(SurfaceSize()), root_passes,
1794 arraysize(root_passes)); 1858 arraysize(root_passes));
1795 1859
1796 RenderPass* root_pass = root_pass_list[1].get(); 1860 RenderPass* root_pass = root_pass_list[1].get();
1797 root_pass->shared_quad_state_list.ElementAt(1) 1861 root_pass->shared_quad_state_list.ElementAt(1)
1798 ->quad_to_target_transform.Translate(10, 10); 1862 ->quad_to_target_transform.Translate(10, 10);
1799 RenderPassDrawQuad* quad = 1863 RenderPassDrawQuad* quad =
1800 static_cast<RenderPassDrawQuad*>(root_pass->quad_list.front()); 1864 static_cast<RenderPassDrawQuad*>(root_pass->quad_list.front());
1801 quad->background_filters.Append(FilterOperation::CreateBlurFilter(2)); 1865 quad->background_filters.Append(FilterOperation::CreateBlurFilter(2));
1802 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2); 1866 root_pass->damage_rect = gfx::Rect(10, 10, 2, 2);
1803 SubmitPassListAsFrame(&factory_, root_surface_id_, &root_pass_list); 1867 SubmitPassListAsFrame(&factory_, root_local_frame_id_, &root_pass_list);
1804 } 1868 }
1805 1869
1806 { 1870 {
1807 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id_); 1871 CompositorFrame aggregated_frame = aggregator_.Aggregate(root_surface_id);
1808 1872
1809 ASSERT_TRUE(aggregated_frame.delegated_frame_data); 1873 ASSERT_TRUE(aggregated_frame.delegated_frame_data);
1810 1874
1811 DelegatedFrameData* frame_data = 1875 DelegatedFrameData* frame_data =
1812 aggregated_frame.delegated_frame_data.get(); 1876 aggregated_frame.delegated_frame_data.get();
1813 1877
1814 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list; 1878 const RenderPassList& aggregated_pass_list = frame_data->render_pass_list;
1815 1879
1816 ASSERT_EQ(3u, aggregated_pass_list.size()); 1880 ASSERT_EQ(3u, aggregated_pass_list.size());
1817 1881
1818 // Pass 0 is solid color quad from root, but outside damage rect. 1882 // Pass 0 is solid color quad from root, but outside damage rect.
1819 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[0]->damage_rect); 1883 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[0]->damage_rect);
1820 EXPECT_EQ(0u, aggregated_pass_list[0]->quad_list.size()); 1884 EXPECT_EQ(0u, aggregated_pass_list[0]->quad_list.size());
1821 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[1]->damage_rect); 1885 EXPECT_EQ(gfx::Rect(SurfaceSize()), aggregated_pass_list[1]->damage_rect);
1822 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size()); 1886 EXPECT_EQ(1u, aggregated_pass_list[1]->quad_list.size());
1823 1887
1824 // First render pass draw quad is outside damage rect, so shouldn't be 1888 // First render pass draw quad is outside damage rect, so shouldn't be
1825 // drawn. SurfaceDrawQuad is after background filter, so corresponding 1889 // drawn. SurfaceDrawQuad is after background filter, so corresponding
1826 // RenderPassDrawQuad should be drawn. 1890 // RenderPassDrawQuad should be drawn.
1827 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[2]->damage_rect); 1891 EXPECT_EQ(gfx::Rect(10, 10, 2, 2), aggregated_pass_list[2]->damage_rect);
1828 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size()); 1892 EXPECT_EQ(1u, aggregated_pass_list[2]->quad_list.size());
1829 } 1893 }
1830 1894
1831 factory_.Destroy(child_surface_id); 1895 factory_.Destroy(child_local_frame_id);
1832 } 1896 }
1833 1897
1834 class SurfaceAggregatorWithResourcesTest : public testing::Test { 1898 class SurfaceAggregatorWithResourcesTest : public testing::Test {
1835 public: 1899 public:
1836 void SetUp() override { 1900 void SetUp() override {
1837 shared_bitmap_manager_.reset(new TestSharedBitmapManager); 1901 shared_bitmap_manager_.reset(new TestSharedBitmapManager);
1838 resource_provider_ = 1902 resource_provider_ =
1839 FakeResourceProvider::Create(nullptr, shared_bitmap_manager_.get()); 1903 FakeResourceProvider::Create(nullptr, shared_bitmap_manager_.get());
1840 1904
1841 aggregator_.reset( 1905 aggregator_.reset(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 bool nearest_neighbor = false; 1973 bool nearest_neighbor = false;
1910 bool secure_output_only = true; 1974 bool secure_output_only = true;
1911 quad->SetAll(sqs, rect, opaque_rect, visible_rect, needs_blending, 1975 quad->SetAll(sqs, rect, opaque_rect, visible_rect, needs_blending,
1912 resource_ids[i], gfx::Size(), premultiplied_alpha, uv_top_left, 1976 resource_ids[i], gfx::Size(), premultiplied_alpha, uv_top_left,
1913 uv_bottom_right, background_color, vertex_opacity, flipped, 1977 uv_bottom_right, background_color, vertex_opacity, flipped,
1914 nearest_neighbor, secure_output_only); 1978 nearest_neighbor, secure_output_only);
1915 } 1979 }
1916 frame_data->render_pass_list.push_back(std::move(pass)); 1980 frame_data->render_pass_list.push_back(std::move(pass));
1917 CompositorFrame frame; 1981 CompositorFrame frame;
1918 frame.delegated_frame_data = std::move(frame_data); 1982 frame.delegated_frame_data = std::move(frame_data);
1919 factory->SubmitCompositorFrame(surface_id, std::move(frame), 1983 factory->SubmitCompositorFrame(surface_id.local_frame_id(), std::move(frame),
1920 SurfaceFactory::DrawCallback()); 1984 SurfaceFactory::DrawCallback());
1921 } 1985 }
1922 1986
1923 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { 1987 TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) {
1924 ResourceTrackingSurfaceFactoryClient client; 1988 ResourceTrackingSurfaceFactoryClient client;
1925 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client); 1989 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client);
1926 SurfaceId surface_id(kArbitraryFrameSinkId, 7u, 0); 1990 LocalFrameId local_frame_id(7u, 0);
1927 factory.Create(surface_id); 1991 SurfaceId surface_id(kArbitraryFrameSinkId, local_frame_id);
1992 factory.Create(local_frame_id);
1928 1993
1929 ResourceId ids[] = {11, 12, 13}; 1994 ResourceId ids[] = {11, 12, 13};
1930 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), 1995 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(),
1931 &factory, surface_id); 1996 &factory, surface_id);
1932 1997
1933 CompositorFrame frame = aggregator_->Aggregate(surface_id); 1998 CompositorFrame frame = aggregator_->Aggregate(surface_id);
1934 1999
1935 // Nothing should be available to be returned yet. 2000 // Nothing should be available to be returned yet.
1936 EXPECT_TRUE(client.returned_resources().empty()); 2001 EXPECT_TRUE(client.returned_resources().empty());
1937 2002
1938 SubmitCompositorFrameWithResources(NULL, 0u, true, SurfaceId(), &factory, 2003 SubmitCompositorFrameWithResources(NULL, 0u, true, SurfaceId(), &factory,
1939 surface_id); 2004 surface_id);
1940 2005
1941 frame = aggregator_->Aggregate(surface_id); 2006 frame = aggregator_->Aggregate(surface_id);
1942 2007
1943 ASSERT_EQ(3u, client.returned_resources().size()); 2008 ASSERT_EQ(3u, client.returned_resources().size());
1944 ResourceId returned_ids[3]; 2009 ResourceId returned_ids[3];
1945 for (size_t i = 0; i < 3; ++i) { 2010 for (size_t i = 0; i < 3; ++i) {
1946 returned_ids[i] = client.returned_resources()[i].id; 2011 returned_ids[i] = client.returned_resources()[i].id;
1947 } 2012 }
1948 EXPECT_THAT(returned_ids, 2013 EXPECT_THAT(returned_ids,
1949 testing::WhenSorted(testing::ElementsAreArray(ids))); 2014 testing::WhenSorted(testing::ElementsAreArray(ids)));
1950 factory.Destroy(surface_id); 2015 factory.Destroy(local_frame_id);
1951 } 2016 }
1952 2017
1953 TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) { 2018 TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) {
1954 ResourceTrackingSurfaceFactoryClient client; 2019 ResourceTrackingSurfaceFactoryClient client;
1955 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client); 2020 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client);
1956 SurfaceId surface_id(kArbitraryFrameSinkId, 7u, 0); 2021 LocalFrameId local_frame_id(7u, 0);
1957 factory.Create(surface_id); 2022 SurfaceId surface_id(kArbitraryFrameSinkId, local_frame_id);
2023 factory.Create(local_frame_id);
1958 2024
1959 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 2025 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
1960 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 2026 std::unique_ptr<RenderPass> pass = RenderPass::Create();
1961 pass->id = RenderPassId(1, 1); 2027 pass->id = RenderPassId(1, 1);
1962 TransferableResource resource; 2028 TransferableResource resource;
1963 resource.id = 11; 2029 resource.id = 11;
1964 // ResourceProvider is software but resource is not, so it should be 2030 // ResourceProvider is software but resource is not, so it should be
1965 // ignored. 2031 // ignored.
1966 resource.is_software = false; 2032 resource.is_software = false;
1967 frame_data->resource_list.push_back(resource); 2033 frame_data->resource_list.push_back(resource);
1968 frame_data->render_pass_list.push_back(std::move(pass)); 2034 frame_data->render_pass_list.push_back(std::move(pass));
1969 CompositorFrame frame; 2035 CompositorFrame frame;
1970 frame.delegated_frame_data = std::move(frame_data); 2036 frame.delegated_frame_data = std::move(frame_data);
1971 factory.SubmitCompositorFrame(surface_id, std::move(frame), 2037 factory.SubmitCompositorFrame(local_frame_id, std::move(frame),
1972 SurfaceFactory::DrawCallback()); 2038 SurfaceFactory::DrawCallback());
1973 2039
1974 CompositorFrame returned_frame = aggregator_->Aggregate(surface_id); 2040 CompositorFrame returned_frame = aggregator_->Aggregate(surface_id);
1975 2041
1976 // Nothing should be available to be returned yet. 2042 // Nothing should be available to be returned yet.
1977 EXPECT_TRUE(client.returned_resources().empty()); 2043 EXPECT_TRUE(client.returned_resources().empty());
1978 2044
1979 SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), &factory, 2045 SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), &factory,
1980 surface_id); 2046 surface_id);
1981 ASSERT_EQ(1u, client.returned_resources().size()); 2047 ASSERT_EQ(1u, client.returned_resources().size());
1982 EXPECT_EQ(11u, client.returned_resources()[0].id); 2048 EXPECT_EQ(11u, client.returned_resources()[0].id);
1983 2049
1984 factory.Destroy(surface_id); 2050 factory.Destroy(local_frame_id);
1985 } 2051 }
1986 2052
1987 TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) { 2053 TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) {
1988 ResourceTrackingSurfaceFactoryClient client; 2054 ResourceTrackingSurfaceFactoryClient client;
1989 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client); 2055 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client);
1990 SurfaceId surface1_id(kArbitraryFrameSinkId, 7u, 0); 2056 LocalFrameId local_frame1_id(7u, 0);
1991 factory.Create(surface1_id); 2057 SurfaceId surface1_id(kArbitraryFrameSinkId, local_frame1_id);
2058 factory.Create(local_frame1_id);
1992 2059
1993 SurfaceId surface2_id(kArbitraryFrameSinkId, 8u, 0); 2060 LocalFrameId local_frame2_id(8u, 0);
1994 factory.Create(surface2_id); 2061 SurfaceId surface2_id(kArbitraryFrameSinkId, local_frame2_id);
2062 factory.Create(local_frame2_id);
1995 2063
1996 ResourceId ids[] = {11, 12, 13}; 2064 ResourceId ids[] = {11, 12, 13};
1997 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), 2065 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(),
1998 &factory, surface1_id); 2066 &factory, surface1_id);
1999 ResourceId ids2[] = {14, 15, 16}; 2067 ResourceId ids2[] = {14, 15, 16};
2000 SubmitCompositorFrameWithResources(ids2, arraysize(ids2), true, SurfaceId(), 2068 SubmitCompositorFrameWithResources(ids2, arraysize(ids2), true, SurfaceId(),
2001 &factory, surface2_id); 2069 &factory, surface2_id);
2002 2070
2003 CompositorFrame frame = aggregator_->Aggregate(surface1_id); 2071 CompositorFrame frame = aggregator_->Aggregate(surface1_id);
2004 2072
2005 SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), &factory, 2073 SubmitCompositorFrameWithResources(NULL, 0, true, SurfaceId(), &factory,
2006 surface1_id); 2074 surface1_id);
2007 2075
2008 // Nothing should be available to be returned yet. 2076 // Nothing should be available to be returned yet.
2009 EXPECT_TRUE(client.returned_resources().empty()); 2077 EXPECT_TRUE(client.returned_resources().empty());
2010 2078
2011 frame = aggregator_->Aggregate(surface2_id); 2079 frame = aggregator_->Aggregate(surface2_id);
2012 2080
2013 // surface1_id wasn't referenced, so its resources should be returned. 2081 // surface1_id wasn't referenced, so its resources should be returned.
2014 ASSERT_EQ(3u, client.returned_resources().size()); 2082 ASSERT_EQ(3u, client.returned_resources().size());
2015 ResourceId returned_ids[3]; 2083 ResourceId returned_ids[3];
2016 for (size_t i = 0; i < 3; ++i) { 2084 for (size_t i = 0; i < 3; ++i) {
2017 returned_ids[i] = client.returned_resources()[i].id; 2085 returned_ids[i] = client.returned_resources()[i].id;
2018 } 2086 }
2019 EXPECT_THAT(returned_ids, 2087 EXPECT_THAT(returned_ids,
2020 testing::WhenSorted(testing::ElementsAreArray(ids))); 2088 testing::WhenSorted(testing::ElementsAreArray(ids)));
2021 EXPECT_EQ(3u, resource_provider_->num_resources()); 2089 EXPECT_EQ(3u, resource_provider_->num_resources());
2022 factory.Destroy(surface1_id); 2090 factory.Destroy(local_frame1_id);
2023 factory.Destroy(surface2_id); 2091 factory.Destroy(local_frame2_id);
2024 } 2092 }
2025 2093
2026 // Ensure that aggregator completely ignores Surfaces that reference invalid 2094 // Ensure that aggregator completely ignores Surfaces that reference invalid
2027 // resources. 2095 // resources.
2028 TEST_F(SurfaceAggregatorWithResourcesTest, InvalidChildSurface) { 2096 TEST_F(SurfaceAggregatorWithResourcesTest, InvalidChildSurface) {
2029 ResourceTrackingSurfaceFactoryClient client; 2097 ResourceTrackingSurfaceFactoryClient client;
2030 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client); 2098 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client);
2031 SurfaceId root_surface_id(kArbitraryFrameSinkId, 7u, 0); 2099 LocalFrameId root_local_frame_id(7u, 0);
2032 factory.Create(root_surface_id); 2100 SurfaceId root_surface_id(kArbitraryFrameSinkId, root_local_frame_id);
2033 SurfaceId middle_surface_id(kArbitraryFrameSinkId, 8u, 0); 2101 factory.Create(root_local_frame_id);
2034 factory.Create(middle_surface_id); 2102 LocalFrameId middle_local_frame_id(8u, 0);
2035 SurfaceId child_surface_id(kArbitraryFrameSinkId, 9u, 0); 2103 SurfaceId middle_surface_id(kArbitraryFrameSinkId, middle_local_frame_id);
2036 factory.Create(child_surface_id); 2104 factory.Create(middle_local_frame_id);
2105 LocalFrameId child_local_frame_id(9u, 0);
2106 SurfaceId child_surface_id(kArbitraryFrameSinkId, child_local_frame_id);
2107 factory.Create(child_local_frame_id);
2037 2108
2038 ResourceId ids[] = {14, 15, 16}; 2109 ResourceId ids[] = {14, 15, 16};
2039 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), 2110 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(),
2040 &factory, child_surface_id); 2111 &factory, child_surface_id);
2041 2112
2042 ResourceId ids2[] = {17, 18, 19}; 2113 ResourceId ids2[] = {17, 18, 19};
2043 SubmitCompositorFrameWithResources(ids2, arraysize(ids2), false, 2114 SubmitCompositorFrameWithResources(ids2, arraysize(ids2), false,
2044 child_surface_id, &factory, 2115 child_surface_id, &factory,
2045 middle_surface_id); 2116 middle_surface_id);
2046 2117
(...skipping 14 matching lines...) Expand all
2061 child_surface_id, &factory, 2132 child_surface_id, &factory,
2062 middle_surface_id); 2133 middle_surface_id);
2063 2134
2064 frame = aggregator_->Aggregate(root_surface_id); 2135 frame = aggregator_->Aggregate(root_surface_id);
2065 2136
2066 pass_list = &frame.delegated_frame_data->render_pass_list; 2137 pass_list = &frame.delegated_frame_data->render_pass_list;
2067 ASSERT_EQ(1u, pass_list->size()); 2138 ASSERT_EQ(1u, pass_list->size());
2068 EXPECT_EQ(3u, pass_list->back()->shared_quad_state_list.size()); 2139 EXPECT_EQ(3u, pass_list->back()->shared_quad_state_list.size());
2069 EXPECT_EQ(9u, pass_list->back()->quad_list.size()); 2140 EXPECT_EQ(9u, pass_list->back()->quad_list.size());
2070 2141
2071 factory.Destroy(root_surface_id); 2142 factory.Destroy(root_local_frame_id);
2072 factory.Destroy(child_surface_id); 2143 factory.Destroy(child_local_frame_id);
2073 factory.Destroy(middle_surface_id); 2144 factory.Destroy(middle_local_frame_id);
2074 } 2145 }
2075 2146
2076 TEST_F(SurfaceAggregatorWithResourcesTest, SecureOutputTexture) { 2147 TEST_F(SurfaceAggregatorWithResourcesTest, SecureOutputTexture) {
2077 ResourceTrackingSurfaceFactoryClient client; 2148 ResourceTrackingSurfaceFactoryClient client;
2078 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client); 2149 SurfaceFactory factory(kArbitraryFrameSinkId, &manager_, &client);
2079 SurfaceId surface1_id(kArbitraryFrameSinkId, 7u, 0); 2150 LocalFrameId local_frame1_id(7u, 0);
2080 factory.Create(surface1_id); 2151 SurfaceId surface1_id(kArbitraryFrameSinkId, local_frame1_id);
2152 factory.Create(local_frame1_id);
2081 2153
2082 SurfaceId surface2_id(kArbitraryFrameSinkId, 8u, 0); 2154 LocalFrameId local_frame2_id(8u, 0);
2083 factory.Create(surface2_id); 2155 SurfaceId surface2_id(kArbitraryFrameSinkId, local_frame2_id);
2156 factory.Create(local_frame2_id);
2084 2157
2085 ResourceId ids[] = {11, 12, 13}; 2158 ResourceId ids[] = {11, 12, 13};
2086 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(), 2159 SubmitCompositorFrameWithResources(ids, arraysize(ids), true, SurfaceId(),
2087 &factory, surface1_id); 2160 &factory, surface1_id);
2088 2161
2089 CompositorFrame frame = aggregator_->Aggregate(surface1_id); 2162 CompositorFrame frame = aggregator_->Aggregate(surface1_id);
2090 2163
2091 RenderPass* render_pass = 2164 RenderPass* render_pass =
2092 frame.delegated_frame_data->render_pass_list.back().get(); 2165 frame.delegated_frame_data->render_pass_list.back().get();
2093 2166
2094 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, render_pass->quad_list.back()->material); 2167 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, render_pass->quad_list.back()->material);
2095 2168
2096 { 2169 {
2097 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); 2170 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
2098 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 2171 std::unique_ptr<RenderPass> pass = RenderPass::Create();
2099 pass->id = RenderPassId(1, 1); 2172 pass->id = RenderPassId(1, 1);
2100 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 2173 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
2101 sqs->opacity = 1.f; 2174 sqs->opacity = 1.f;
2102 SurfaceDrawQuad* surface_quad = 2175 SurfaceDrawQuad* surface_quad =
2103 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); 2176 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>();
2104 surface_quad->SetNew(sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 2177 surface_quad->SetNew(sqs, gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1),
2105 surface1_id); 2178 surface1_id);
2106 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 2179 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest());
2107 2180
2108 frame_data->render_pass_list.push_back(std::move(pass)); 2181 frame_data->render_pass_list.push_back(std::move(pass));
2109 CompositorFrame frame; 2182 CompositorFrame frame;
2110 frame.delegated_frame_data = std::move(frame_data); 2183 frame.delegated_frame_data = std::move(frame_data);
2111 factory.SubmitCompositorFrame(surface2_id, std::move(frame), 2184 factory.SubmitCompositorFrame(local_frame2_id, std::move(frame),
2112 SurfaceFactory::DrawCallback()); 2185 SurfaceFactory::DrawCallback());
2113 } 2186 }
2114 2187
2115 frame = aggregator_->Aggregate(surface2_id); 2188 frame = aggregator_->Aggregate(surface2_id);
2116 EXPECT_EQ(1u, frame.delegated_frame_data->render_pass_list.size()); 2189 EXPECT_EQ(1u, frame.delegated_frame_data->render_pass_list.size());
2117 render_pass = frame.delegated_frame_data->render_pass_list.front().get(); 2190 render_pass = frame.delegated_frame_data->render_pass_list.front().get();
2118 2191
2119 // Parent has copy request, so texture should not be drawn. 2192 // Parent has copy request, so texture should not be drawn.
2120 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2193 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2121 2194
2122 frame = aggregator_->Aggregate(surface2_id); 2195 frame = aggregator_->Aggregate(surface2_id);
2123 EXPECT_EQ(1u, frame.delegated_frame_data->render_pass_list.size()); 2196 EXPECT_EQ(1u, frame.delegated_frame_data->render_pass_list.size());
2124 render_pass = frame.delegated_frame_data->render_pass_list.front().get(); 2197 render_pass = frame.delegated_frame_data->render_pass_list.front().get();
2125 2198
2126 // Copy request has been executed earlier, so texture should be drawn. 2199 // Copy request has been executed earlier, so texture should be drawn.
2127 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, 2200 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT,
2128 render_pass->quad_list.front()->material); 2201 render_pass->quad_list.front()->material);
2129 2202
2130 aggregator_->set_output_is_secure(false); 2203 aggregator_->set_output_is_secure(false);
2131 2204
2132 frame = aggregator_->Aggregate(surface2_id); 2205 frame = aggregator_->Aggregate(surface2_id);
2133 render_pass = frame.delegated_frame_data->render_pass_list.back().get(); 2206 render_pass = frame.delegated_frame_data->render_pass_list.back().get();
2134 2207
2135 // Output is insecure, so texture should be drawn. 2208 // Output is insecure, so texture should be drawn.
2136 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2209 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2137 2210
2138 factory.Destroy(surface1_id); 2211 factory.Destroy(local_frame1_id);
2139 factory.Destroy(surface2_id); 2212 factory.Destroy(local_frame2_id);
2140 } 2213 }
2141 2214
2142 } // namespace 2215 } // namespace
2143 } // namespace cc 2216 } // namespace cc
2144 2217
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698