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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 448303002: Use custom ListContainer to allocate DrawQuads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perftest
Patch Set: fix win trybot compile error Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 gfx::Rect layer_invalidation(150, 200, 30, 180); 1380 gfx::Rect layer_invalidation(150, 200, 30, 180);
1381 Region invalidation(layer_invalidation); 1381 Region invalidation(layer_invalidation);
1382 AddDefaultTilingsWithInvalidation(invalidation); 1382 AddDefaultTilingsWithInvalidation(invalidation);
1383 1383
1384 AppendQuadsData data; 1384 AppendQuadsData data;
1385 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); 1385 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL);
1386 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); 1386 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
1387 active_layer_->DidDraw(NULL); 1387 active_layer_->DidDraw(NULL);
1388 1388
1389 ASSERT_EQ(1U, render_pass->quad_list.size()); 1389 ASSERT_EQ(1U, render_pass->quad_list.size());
1390 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); 1390 EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
1391 render_pass->quad_list.front()->material);
1391 } 1392 }
1392 1393
1393 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { 1394 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) {
1394 gfx::Size tile_size(100, 100); 1395 gfx::Size tile_size(100, 100);
1395 gfx::Size layer_bounds(1000, 1000); 1396 gfx::Size layer_bounds(1000, 1000);
1396 1397
1397 scoped_refptr<FakePicturePileImpl> pending_pile = 1398 scoped_refptr<FakePicturePileImpl> pending_pile =
1398 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 1399 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
1399 // Layers with entirely empty piles can't get tilings. 1400 // Layers with entirely empty piles can't get tilings.
1400 pending_pile->AddRecordingAt(0, 0); 1401 pending_pile->AddRecordingAt(0, 0);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 MockOcclusionTracker<LayerImpl> occlusion_tracker; 1698 MockOcclusionTracker<LayerImpl> occlusion_tracker;
1698 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1699 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1699 AppendQuadsData data; 1700 AppendQuadsData data;
1700 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); 1701 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1701 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); 1702 active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data);
1702 active_layer_->DidDraw(NULL); 1703 active_layer_->DidDraw(NULL);
1703 1704
1704 // All high res tiles drew, and the one ideal res tile drew. 1705 // All high res tiles drew, and the one ideal res tile drew.
1705 ASSERT_GT(render_pass->quad_list.size(), 9u); 1706 ASSERT_GT(render_pass->quad_list.size(), 9u);
1706 EXPECT_EQ(gfx::SizeF(99.f, 99.f), 1707 EXPECT_EQ(gfx::SizeF(99.f, 99.f),
1707 TileDrawQuad::MaterialCast(render_pass->quad_list[0]) 1708 TileDrawQuad::MaterialCast(render_pass->quad_list.front())
1708 ->tex_coord_rect.size()); 1709 ->tex_coord_rect.size());
1710 QuadList::Iterator quad_iter = render_pass->quad_list.begin();
1711 ++quad_iter;
1709 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), 1712 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f),
1710 TileDrawQuad::MaterialCast(render_pass->quad_list[1]) 1713 TileDrawQuad::MaterialCast(&*quad_iter)->tex_coord_rect.size());
1711 ->tex_coord_rect.size());
1712 1714
1713 // Neither the high res nor the ideal tiles were considered as incomplete. 1715 // Neither the high res nor the ideal tiles were considered as incomplete.
1714 EXPECT_EQ(0u, data.num_missing_tiles); 1716 EXPECT_EQ(0u, data.num_missing_tiles);
1715 EXPECT_EQ(0u, data.num_incomplete_tiles); 1717 EXPECT_EQ(0u, data.num_incomplete_tiles);
1716 } 1718 }
1717 1719
1718 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { 1720 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) {
1719 gfx::Size layer_bounds(400, 400); 1721 gfx::Size layer_bounds(400, 400);
1720 gfx::Size tile_size(100, 100); 1722 gfx::Size tile_size(100, 100);
1721 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 1723 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
(...skipping 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
4362 SetupPendingTree(pending_pile2); 4364 SetupPendingTree(pending_pile2);
4363 ActivateTree(); 4365 ActivateTree();
4364 4366
4365 // We've switched to a solid color, so we should end up with no tilings. 4367 // We've switched to a solid color, so we should end up with no tilings.
4366 ASSERT_TRUE(active_layer_->tilings()); 4368 ASSERT_TRUE(active_layer_->tilings());
4367 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 4369 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
4368 } 4370 }
4369 4371
4370 } // namespace 4372 } // namespace
4371 } // namespace cc 4373 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698