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

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

Issue 2544203003: Delete old RenderPassId mappings in SurfaceAggregator. (Closed)
Patch Set: change test checks, add comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface_aggregator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 SubmitCompositorFrame(&factory_, passes, arraysize(passes), 254 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
255 root_local_frame_id_); 255 root_local_frame_id_);
256 256
257 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_); 257 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_frame_id_);
258 SurfaceId ids[] = {root_surface_id}; 258 SurfaceId ids[] = {root_surface_id};
259 259
260 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids)); 260 AggregateAndVerify(passes, arraysize(passes), ids, arraysize(ids));
261 } 261 }
262 262
263 // Ensure that the render pass ID map properly keeps and deletes entries.
264 TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassDeallocation) {
265 test::Quad quads[][2] = {{test::Quad::SolidColorQuad(SK_ColorWHITE),
266 test::Quad::SolidColorQuad(SK_ColorLTGRAY)},
267 {test::Quad::SolidColorQuad(SK_ColorGRAY),
268 test::Quad::SolidColorQuad(SK_ColorDKGRAY)}};
269 test::Pass passes[] = {
270 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 2)),
271 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 1))};
272
273 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
274 root_local_frame_id_);
275
276 SurfaceId surface_id(factory_.frame_sink_id(), root_local_frame_id_);
277
278 CompositorFrame aggregated_frame;
279 aggregated_frame = aggregator_.Aggregate(surface_id);
280 RenderPassId id0 = aggregated_frame.render_pass_list[0]->id;
281 RenderPassId id1 = aggregated_frame.render_pass_list[1]->id;
282 EXPECT_NE(id1, id0);
283
284 // Aggregated RenderPassIds should remain the same between frames.
285 aggregated_frame = aggregator_.Aggregate(surface_id);
286 EXPECT_EQ(id0, aggregated_frame.render_pass_list[0]->id);
287 EXPECT_EQ(id1, aggregated_frame.render_pass_list[1]->id);
288
289 test::Pass passes2[] = {
290 test::Pass(quads[0], arraysize(quads[0]), RenderPassId(1, 3)),
291 test::Pass(quads[1], arraysize(quads[1]), RenderPassId(1, 1))};
292
293 SubmitCompositorFrame(&factory_, passes2, arraysize(passes2),
294 root_local_frame_id_);
295
296 // The RenderPass that still exists should keep the same ID.
297 aggregated_frame = aggregator_.Aggregate(surface_id);
298 RenderPassId id2 = aggregated_frame.render_pass_list[0]->id;
299 EXPECT_NE(id2, id1);
300 EXPECT_NE(id2, id0);
301 EXPECT_EQ(id1, aggregated_frame.render_pass_list[1]->id);
302
303 SubmitCompositorFrame(&factory_, passes, arraysize(passes),
304 root_local_frame_id_);
305
306 // RenderPassId(1, 2) didn't exist in the previous frame, so it should be
307 // mapped to a new ID.
308 aggregated_frame = aggregator_.Aggregate(surface_id);
309 RenderPassId id3 = aggregated_frame.render_pass_list[0]->id;
310 EXPECT_NE(id3, id2);
311 EXPECT_NE(id3, id1);
312 EXPECT_NE(id3, id0);
313 EXPECT_EQ(id1, aggregated_frame.render_pass_list[1]->id);
314 }
315
263 // This tests very simple embedding. root_surface has a frame containing a few 316 // This tests very simple embedding. root_surface has a frame containing a few
264 // solid color quads and a surface quad referencing embedded_surface. 317 // solid color quads and a surface quad referencing embedded_surface.
265 // embedded_surface has a frame containing only a solid color quad. The solid 318 // embedded_surface has a frame containing only a solid color quad. The solid
266 // color quad should be aggregated into the final frame. 319 // color quad should be aggregated into the final frame.
267 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) { 320 TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) {
268 SurfaceFactory embedded_factory(kArbitraryChildFrameSinkId, &manager_, 321 SurfaceFactory embedded_factory(kArbitraryChildFrameSinkId, &manager_,
269 &empty_client_); 322 &empty_client_);
270 LocalFrameId embedded_local_frame_id = allocator_.GenerateId(); 323 LocalFrameId embedded_local_frame_id = allocator_.GenerateId();
271 SurfaceId embedded_surface_id(embedded_factory.frame_sink_id(), 324 SurfaceId embedded_surface_id(embedded_factory.frame_sink_id(),
272 embedded_local_frame_id); 325 embedded_local_frame_id);
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 // Output is insecure, so texture should be drawn. 2087 // Output is insecure, so texture should be drawn.
2035 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2088 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2036 2089
2037 factory1.EvictSurface(); 2090 factory1.EvictSurface();
2038 factory2.EvictSurface(); 2091 factory2.EvictSurface();
2039 } 2092 }
2040 2093
2041 } // namespace 2094 } // namespace
2042 } // namespace cc 2095 } // namespace cc
2043 2096
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698