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

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

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +test Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/memory_history.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 AppendQuadsData data; 1383 AppendQuadsData data;
1384 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); 1384 active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL);
1385 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1385 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1386 active_layer_->DidDraw(NULL); 1386 active_layer_->DidDraw(NULL);
1387 1387
1388 ASSERT_EQ(1U, render_pass->quad_list.size()); 1388 ASSERT_EQ(1U, render_pass->quad_list.size());
1389 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, 1389 EXPECT_EQ(DrawQuad::PICTURE_CONTENT,
1390 render_pass->quad_list.front()->material); 1390 render_pass->quad_list.front()->material);
1391 } 1391 }
1392 1392
1393 TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) {
1394 gfx::Size tile_size(100, 100);
1395 gfx::Size layer_bounds(1000, 1000);
1396
1397 scoped_refptr<FakePicturePileImpl> pending_pile =
1398 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
1399 // Layers with entirely empty piles can't get tilings.
1400 pending_pile->AddRecordingAt(0, 0);
1401
1402 SetupPendingTree(pending_pile);
1403
1404 ASSERT_TRUE(pending_layer_->CanHaveTilings());
1405 pending_layer_->AddTiling(1.0f);
1406 pending_layer_->AddTiling(2.0f);
1407
1408 // It should be safe to call this (and MarkVisibleResourcesAsRequired)
1409 // on a layer with no recordings.
1410 host_impl_.pending_tree()->UpdateDrawProperties();
1411 pending_layer_->MarkVisibleResourcesAsRequired();
1412 }
1413
1414 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { 1393 TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) {
1415 gfx::Size tile_size(100, 100); 1394 gfx::Size tile_size(100, 100);
1416 gfx::Size layer_bounds(200, 200); 1395 gfx::Size layer_bounds(200, 200);
1417 1396
1418 scoped_refptr<FakePicturePileImpl> pending_pile = 1397 scoped_refptr<FakePicturePileImpl> pending_pile =
1419 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1398 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1420 SetupPendingTree(pending_pile); 1399 SetupPendingTree(pending_pile);
1421 1400
1422 gfx::Transform transform; 1401 gfx::Transform transform;
1423 gfx::Transform transform_for_tile_priority; 1402 gfx::Transform transform_for_tile_priority;
1424 bool resourceless_software_draw = false; 1403 bool resourceless_software_draw = false;
1425 gfx::Rect viewport(0, 0, 100, 200); 1404 gfx::Rect viewport(0, 0, 100, 200);
1426 host_impl_.SetExternalDrawConstraints(transform, 1405 host_impl_.SetExternalDrawConstraints(transform,
1427 viewport, 1406 viewport,
1428 viewport, 1407 viewport,
1429 viewport, 1408 viewport,
1430 transform, 1409 transform,
1431 resourceless_software_draw); 1410 resourceless_software_draw);
1432 1411
1433 pending_layer_->set_fixed_tile_size(tile_size); 1412 pending_layer_->set_fixed_tile_size(tile_size);
1434 ASSERT_TRUE(pending_layer_->CanHaveTilings()); 1413 ASSERT_TRUE(pending_layer_->CanHaveTilings());
1435 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); 1414 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f);
1436 host_impl_.pending_tree()->UpdateDrawProperties(); 1415 host_impl_.pending_tree()->UpdateDrawProperties();
1437 EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION);
1438 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority()); 1416 EXPECT_EQ(viewport, pending_layer_->visible_rect_for_tile_priority());
1439 1417
1440 // Fake set priorities. 1418 base::TimeTicks time_ticks;
1441 for (PictureLayerTiling::CoverageIterator iter( 1419 time_ticks += base::TimeDelta::FromMilliseconds(1);
1442 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); 1420 host_impl_.SetCurrentBeginFrameArgs(
1443 iter; 1421 CreateBeginFrameArgsForTesting(time_ticks));
1444 ++iter) { 1422 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
1445 if (!*iter) 1423 EXPECT_EQ(HIGH_RESOLUTION, tiling->resolution());
1446 continue;
1447 Tile* tile = *iter;
1448 TilePriority priority;
1449 priority.resolution = HIGH_RESOLUTION;
1450 gfx::Rect tile_bounds = iter.geometry_rect();
1451 if (pending_layer_->visible_rect_for_tile_priority().Intersects(
1452 tile_bounds)) {
1453 priority.priority_bin = TilePriority::NOW;
1454 priority.distance_to_visible = 0.f;
1455 } else {
1456 priority.priority_bin = TilePriority::SOON;
1457 priority.distance_to_visible = 1.f;
1458 }
1459 tile->SetPriority(PENDING_TREE, priority);
1460 }
1461
1462 pending_layer_->MarkVisibleResourcesAsRequired();
1463 1424
1464 int num_visible = 0; 1425 int num_visible = 0;
1465 int num_offscreen = 0; 1426 int num_offscreen = 0;
1466 1427
1467 for (PictureLayerTiling::CoverageIterator iter( 1428 for (PictureLayerTiling::TilingRasterTileIterator iter(tiling); iter;
1468 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds));
1469 iter;
1470 ++iter) { 1429 ++iter) {
1471 if (!*iter)
1472 continue;
1473 const Tile* tile = *iter; 1430 const Tile* tile = *iter;
1431 DCHECK(tile);
1474 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { 1432 if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) {
1475 EXPECT_TRUE(tile->required_for_activation()); 1433 EXPECT_TRUE(tile->required_for_activation());
1476 num_visible++; 1434 num_visible++;
1477 } else { 1435 } else {
1478 EXPECT_FALSE(tile->required_for_activation()); 1436 EXPECT_FALSE(tile->required_for_activation());
1479 num_offscreen++; 1437 num_offscreen++;
1480 } 1438 }
1481 } 1439 }
1482 1440
1483 EXPECT_GT(num_visible, 0); 1441 EXPECT_GT(num_visible, 0);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 host_impl_.pending_tree()->UpdateDrawProperties(); 1478 host_impl_.pending_tree()->UpdateDrawProperties();
1521 1479
1522 // Set visible content rect that is different from 1480 // Set visible content rect that is different from
1523 // external_viewport_for_tile_priority. 1481 // external_viewport_for_tile_priority.
1524 pending_layer_->draw_properties().visible_content_rect = visible_content_rect; 1482 pending_layer_->draw_properties().visible_content_rect = visible_content_rect;
1525 time_ticks += base::TimeDelta::FromMilliseconds(200); 1483 time_ticks += base::TimeDelta::FromMilliseconds(200);
1526 host_impl_.SetCurrentBeginFrameArgs( 1484 host_impl_.SetCurrentBeginFrameArgs(
1527 CreateBeginFrameArgsForTesting(time_ticks)); 1485 CreateBeginFrameArgsForTesting(time_ticks));
1528 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw); 1486 pending_layer_->UpdateTiles(Occlusion(), resourceless_software_draw);
1529 1487
1530 pending_layer_->MarkVisibleResourcesAsRequired();
1531
1532 // Intersect the two rects. Any tile outside should not be required for 1488 // Intersect the two rects. Any tile outside should not be required for
1533 // activation. 1489 // activation.
1534 gfx::Rect viewport_for_tile_priority = 1490 gfx::Rect viewport_for_tile_priority =
1535 pending_layer_->GetViewportForTilePriorityInContentSpace(); 1491 pending_layer_->GetViewportForTilePriorityInContentSpace();
1536 viewport_for_tile_priority.Intersect(pending_layer_->visible_content_rect()); 1492 viewport_for_tile_priority.Intersect(pending_layer_->visible_content_rect());
1537 1493
1538 int num_inside = 0; 1494 int num_inside = 0;
1539 int num_outside = 0; 1495 int num_outside = 0;
1540 for (PictureLayerTiling::CoverageIterator iter( 1496 for (PictureLayerTiling::CoverageIterator iter(
1541 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); 1497 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds));
(...skipping 23 matching lines...) Expand all
1565 1521
1566 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1522 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1567 AppendQuadsData data; 1523 AppendQuadsData data;
1568 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); 1524 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1569 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1525 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1570 active_layer_->DidDraw(NULL); 1526 active_layer_->DidDraw(NULL);
1571 1527
1572 // All tiles in activation rect is ready to draw. 1528 // All tiles in activation rect is ready to draw.
1573 EXPECT_EQ(0u, data.num_missing_tiles); 1529 EXPECT_EQ(0u, data.num_missing_tiles);
1574 EXPECT_EQ(0u, data.num_incomplete_tiles); 1530 EXPECT_EQ(0u, data.num_incomplete_tiles);
1531 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
vmpstr 2014/10/09 00:27:26 Here.
1575 } 1532 }
1576 1533
1577 TEST_F(PictureLayerImplTest, HighResTileIsComplete) { 1534 TEST_F(PictureLayerImplTest, HighResTileIsComplete) {
1578 base::TimeTicks time_ticks; 1535 base::TimeTicks time_ticks;
1579 time_ticks += base::TimeDelta::FromMilliseconds(1); 1536 time_ticks += base::TimeDelta::FromMilliseconds(1);
1580 host_impl_.SetCurrentBeginFrameArgs( 1537 host_impl_.SetCurrentBeginFrameArgs(
1581 CreateBeginFrameArgsForTesting(time_ticks)); 1538 CreateBeginFrameArgsForTesting(time_ticks));
1582 1539
1583 gfx::Size tile_size(100, 100); 1540 gfx::Size tile_size(100, 100);
1584 gfx::Size layer_bounds(200, 200); 1541 gfx::Size layer_bounds(200, 200);
(...skipping 15 matching lines...) Expand all
1600 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1557 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1601 AppendQuadsData data; 1558 AppendQuadsData data;
1602 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); 1559 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1603 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1560 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1604 active_layer_->DidDraw(NULL); 1561 active_layer_->DidDraw(NULL);
1605 1562
1606 // All high res tiles drew, nothing was incomplete. 1563 // All high res tiles drew, nothing was incomplete.
1607 EXPECT_EQ(9u, render_pass->quad_list.size()); 1564 EXPECT_EQ(9u, render_pass->quad_list.size());
1608 EXPECT_EQ(0u, data.num_missing_tiles); 1565 EXPECT_EQ(0u, data.num_missing_tiles);
1609 EXPECT_EQ(0u, data.num_incomplete_tiles); 1566 EXPECT_EQ(0u, data.num_incomplete_tiles);
1567 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
1568 }
1569
1570 TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) {
vmpstr 2014/10/09 00:27:26 Over here.
1571 base::TimeTicks time_ticks;
1572 time_ticks += base::TimeDelta::FromMilliseconds(1);
1573 host_impl_.SetCurrentBeginFrameArgs(
1574 CreateBeginFrameArgsForTesting(time_ticks));
1575
1576 gfx::Size tile_size(100, 100);
1577 gfx::Size layer_bounds(200, 200);
1578
1579 host_impl_.SetViewportSize(layer_bounds);
1580
1581 scoped_refptr<FakePicturePileImpl> pending_pile =
1582 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1583 SetupPendingTree(pending_pile);
1584 ActivateTree();
1585
1586 active_layer_->set_fixed_tile_size(tile_size);
1587 host_impl_.active_tree()->UpdateDrawProperties();
1588
1589 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1590 AppendQuadsData data;
1591 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1592 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1593 active_layer_->DidDraw(NULL);
1594
1595 EXPECT_EQ(1u, render_pass->quad_list.size());
1596 EXPECT_EQ(1u, data.num_missing_tiles);
1597 EXPECT_EQ(0u, data.num_incomplete_tiles);
1598 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads());
1599 }
1600
1601 TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) {
vmpstr 2014/10/09 00:27:26 And over here.
1602 base::TimeTicks time_ticks;
1603 time_ticks += base::TimeDelta::FromMilliseconds(1);
1604 host_impl_.SetCurrentBeginFrameArgs(
1605 CreateBeginFrameArgsForTesting(time_ticks));
1606
1607 gfx::Size tile_size(100, 100);
1608 gfx::Size layer_bounds(200, 200);
1609
1610 host_impl_.SetViewportSize(layer_bounds);
1611
1612 scoped_refptr<FakePicturePileImpl> pending_pile =
1613 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1614 SetupPendingTree(pending_pile);
1615 ActivateTree();
1616
1617 active_layer_->set_fixed_tile_size(tile_size);
1618 host_impl_.active_tree()->UpdateDrawProperties();
1619 std::vector<Tile*> low_tiles =
1620 active_layer_->tilings()->tiling_at(1)->AllTilesForTesting();
1621 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(low_tiles);
1622
1623 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1624 AppendQuadsData data;
1625 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1626 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1627 active_layer_->DidDraw(NULL);
1628
1629 EXPECT_EQ(1u, render_pass->quad_list.size());
1630 EXPECT_EQ(0u, data.num_missing_tiles);
1631 EXPECT_EQ(1u, data.num_incomplete_tiles);
1632 EXPECT_TRUE(active_layer_->only_used_low_res_last_append_quads());
1610 } 1633 }
1611 1634
1612 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { 1635 TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) {
1613 base::TimeTicks time_ticks; 1636 base::TimeTicks time_ticks;
1614 time_ticks += base::TimeDelta::FromMilliseconds(1); 1637 time_ticks += base::TimeDelta::FromMilliseconds(1);
1615 host_impl_.SetCurrentBeginFrameArgs( 1638 host_impl_.SetCurrentBeginFrameArgs(
1616 CreateBeginFrameArgsForTesting(time_ticks)); 1639 CreateBeginFrameArgsForTesting(time_ticks));
1617 1640
1618 gfx::Size tile_size(100, 100); 1641 gfx::Size tile_size(100, 100);
1619 gfx::Size layer_bounds(200, 200); 1642 gfx::Size layer_bounds(200, 200);
(...skipping 21 matching lines...) Expand all
1641 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 1664 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
1642 AppendQuadsData data; 1665 AppendQuadsData data;
1643 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL); 1666 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, NULL);
1644 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data); 1667 active_layer_->AppendQuads(render_pass.get(), Occlusion(), &data);
1645 active_layer_->DidDraw(NULL); 1668 active_layer_->DidDraw(NULL);
1646 1669
1647 // The missing high res tile was replaced by a low res tile. 1670 // The missing high res tile was replaced by a low res tile.
1648 EXPECT_EQ(9u, render_pass->quad_list.size()); 1671 EXPECT_EQ(9u, render_pass->quad_list.size());
1649 EXPECT_EQ(0u, data.num_missing_tiles); 1672 EXPECT_EQ(0u, data.num_missing_tiles);
1650 EXPECT_EQ(1u, data.num_incomplete_tiles); 1673 EXPECT_EQ(1u, data.num_incomplete_tiles);
1674 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
1651 } 1675 }
1652 1676
1653 TEST_F(PictureLayerImplTest, 1677 TEST_F(PictureLayerImplTest,
1654 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { 1678 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) {
1655 base::TimeTicks time_ticks; 1679 base::TimeTicks time_ticks;
1656 time_ticks += base::TimeDelta::FromMilliseconds(1); 1680 time_ticks += base::TimeDelta::FromMilliseconds(1);
1657 host_impl_.SetCurrentBeginFrameArgs( 1681 host_impl_.SetCurrentBeginFrameArgs(
1658 CreateBeginFrameArgsForTesting(time_ticks)); 1682 CreateBeginFrameArgsForTesting(time_ticks));
1659 1683
1660 gfx::Size tile_size(100, 100); 1684 gfx::Size tile_size(100, 100);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 EXPECT_EQ(gfx::SizeF(99.f, 99.f), 1734 EXPECT_EQ(gfx::SizeF(99.f, 99.f),
1711 TileDrawQuad::MaterialCast(render_pass->quad_list.front()) 1735 TileDrawQuad::MaterialCast(render_pass->quad_list.front())
1712 ->tex_coord_rect.size()); 1736 ->tex_coord_rect.size());
1713 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f), 1737 EXPECT_EQ(gfx::SizeF(49.5f, 49.5f),
1714 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1)) 1738 TileDrawQuad::MaterialCast(render_pass->quad_list.ElementAt(1))
1715 ->tex_coord_rect.size()); 1739 ->tex_coord_rect.size());
1716 1740
1717 // Neither the high res nor the ideal tiles were considered as incomplete. 1741 // Neither the high res nor the ideal tiles were considered as incomplete.
1718 EXPECT_EQ(0u, data.num_missing_tiles); 1742 EXPECT_EQ(0u, data.num_missing_tiles);
1719 EXPECT_EQ(0u, data.num_incomplete_tiles); 1743 EXPECT_EQ(0u, data.num_incomplete_tiles);
1744 EXPECT_FALSE(active_layer_->only_used_low_res_last_append_quads());
1720 } 1745 }
1721 1746
1722 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { 1747 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) {
1723 gfx::Size layer_bounds(400, 400); 1748 gfx::Size layer_bounds(400, 400);
1724 gfx::Size tile_size(100, 100); 1749 gfx::Size tile_size(100, 100);
1725 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 1750 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
1726 1751
1727 // No tiles shared. 1752 // No tiles shared.
1728 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); 1753 pending_layer_->set_invalidation(gfx::Rect(layer_bounds));
1729 1754
1730 CreateHighLowResAndSetAllTilesVisible(); 1755 CreateHighLowResAndSetAllTilesVisible();
1731 1756
1732 active_layer_->SetAllTilesReady(); 1757 active_layer_->SetAllTilesReady();
1733 1758
1734 // No shared tiles and all active tiles ready, so pending can only 1759 // No shared tiles and all active tiles ready, so pending can only
1735 // activate with all high res tiles. 1760 // activate with all high res tiles.
1736 pending_layer_->MarkVisibleResourcesAsRequired(); 1761 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1762 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1763
1737 AssertAllTilesRequired(pending_layer_->HighResTiling()); 1764 AssertAllTilesRequired(pending_layer_->HighResTiling());
1738 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1765 AssertNoTilesRequired(pending_layer_->LowResTiling());
1739 } 1766 }
1740 1767
1741 TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { 1768 TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) {
1742 gfx::Size layer_bounds(400, 400); 1769 gfx::Size layer_bounds(400, 400);
1743 gfx::Size tile_size(100, 100); 1770 gfx::Size tile_size(100, 100);
1744 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 1771 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
1745 1772
1746 // All tiles shared (no invalidation). 1773 // All tiles shared (no invalidation).
1747 CreateHighLowResAndSetAllTilesVisible(); 1774 CreateHighLowResAndSetAllTilesVisible();
1748 1775
1749 // Verify active tree not ready. 1776 // Verify active tree not ready.
1750 Tile* some_active_tile = 1777 Tile* some_active_tile =
1751 active_layer_->HighResTiling()->AllTilesForTesting()[0]; 1778 active_layer_->HighResTiling()->AllTilesForTesting()[0];
1752 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); 1779 EXPECT_FALSE(some_active_tile->IsReadyToDraw());
1753 1780
1754 // When high res are required, even if the active tree is not ready, 1781 // When high res are required, even if the active tree is not ready,
1755 // the high res tiles must be ready. 1782 // the high res tiles must be ready.
1756 host_impl_.active_tree()->SetRequiresHighResToDraw(); 1783 host_impl_.active_tree()->SetRequiresHighResToDraw();
1757 pending_layer_->MarkVisibleResourcesAsRequired(); 1784
1785 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1786 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1787
1758 AssertAllTilesRequired(pending_layer_->HighResTiling()); 1788 AssertAllTilesRequired(pending_layer_->HighResTiling());
1759 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1789 AssertNoTilesRequired(pending_layer_->LowResTiling());
1760 } 1790 }
1761 1791
1762 TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { 1792 TEST_F(PictureLayerImplTest, AllHighResRequiredEvenIfShared) {
1763 gfx::Size layer_bounds(400, 400); 1793 gfx::Size layer_bounds(400, 400);
1764 gfx::Size tile_size(100, 100); 1794 gfx::Size tile_size(100, 100);
1765 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 1795 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
1766 1796
1767 CreateHighLowResAndSetAllTilesVisible(); 1797 CreateHighLowResAndSetAllTilesVisible();
1768 1798
1769 Tile* some_active_tile = 1799 Tile* some_active_tile =
1770 active_layer_->HighResTiling()->AllTilesForTesting()[0]; 1800 active_layer_->HighResTiling()->AllTilesForTesting()[0];
1771 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); 1801 EXPECT_FALSE(some_active_tile->IsReadyToDraw());
1772 1802
1773 // All tiles shared (no invalidation), so even though the active tree's 1803 // All tiles shared (no invalidation), so even though the active tree's
1774 // tiles aren't ready, there is nothing required. 1804 // tiles aren't ready, the high res tiles are required for activation.
1775 pending_layer_->MarkVisibleResourcesAsRequired(); 1805 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1806 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1807
1808 AssertAllTilesRequired(pending_layer_->HighResTiling());
1809 AssertNoTilesRequired(pending_layer_->LowResTiling());
1810 }
1811
1812 TEST_F(PictureLayerImplTest, DisallowRequiredForActivation) {
1813 gfx::Size layer_bounds(400, 400);
1814 gfx::Size tile_size(100, 100);
1815 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
1816
1817 CreateHighLowResAndSetAllTilesVisible();
1818
1819 Tile* some_active_tile =
1820 active_layer_->HighResTiling()->AllTilesForTesting()[0];
1821 EXPECT_FALSE(some_active_tile->IsReadyToDraw());
1822
1823 pending_layer_->HighResTiling()->set_can_require_tiles_for_activation(false);
1824 pending_layer_->LowResTiling()->set_can_require_tiles_for_activation(false);
1825
1826 // If we disallow required for activation, no tiles can be required.
1827 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1828 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1829
1776 AssertNoTilesRequired(pending_layer_->HighResTiling()); 1830 AssertNoTilesRequired(pending_layer_->HighResTiling());
1777 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1831 AssertNoTilesRequired(pending_layer_->LowResTiling());
1778 } 1832 }
1779 1833
1780 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { 1834 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
1781 gfx::Size layer_bounds(400, 400); 1835 gfx::Size layer_bounds(400, 400);
1782 gfx::Size tile_size(100, 100); 1836 gfx::Size tile_size(100, 100);
1783 scoped_refptr<FakePicturePileImpl> pending_pile = 1837 scoped_refptr<FakePicturePileImpl> pending_pile =
1784 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1838 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1785 // This pile will create tilings, but has no recordings so will not create any 1839 // This pile will create tilings, but has no recordings so will not create any
1786 // tiles. This is attempting to simulate scrolling past the end of recorded 1840 // tiles. This is attempting to simulate scrolling past the end of recorded
1787 // content on the active layer, where the recordings are so far away that 1841 // content on the active layer, where the recordings are so far away that
1788 // no tiles are created. 1842 // no tiles are created.
1789 scoped_refptr<FakePicturePileImpl> active_pile = 1843 scoped_refptr<FakePicturePileImpl> active_pile =
1790 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 1844 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
1791 tile_size, layer_bounds); 1845 tile_size, layer_bounds);
1792 SetupTrees(pending_pile, active_pile); 1846 SetupTrees(pending_pile, active_pile);
1793 pending_layer_->set_fixed_tile_size(tile_size); 1847 pending_layer_->set_fixed_tile_size(tile_size);
1794 active_layer_->set_fixed_tile_size(tile_size); 1848 active_layer_->set_fixed_tile_size(tile_size);
1795 1849
1796 CreateHighLowResAndSetAllTilesVisible(); 1850 CreateHighLowResAndSetAllTilesVisible();
1797 1851
1798 // Active layer has tilings, but no tiles due to missing recordings. 1852 // Active layer has tilings, but no tiles due to missing recordings.
1799 EXPECT_TRUE(active_layer_->CanHaveTilings()); 1853 EXPECT_TRUE(active_layer_->CanHaveTilings());
1800 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u); 1854 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u);
1801 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u); 1855 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u);
1802 1856
1803 // Since the active layer has no tiles at all, the pending layer doesn't 1857 // Since the active layer has no tiles at all, the pending layer doesn't
1804 // need content in order to activate. 1858 // need content in order to activate.
1805 pending_layer_->MarkVisibleResourcesAsRequired(); 1859 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1860 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1861
1806 AssertNoTilesRequired(pending_layer_->HighResTiling()); 1862 AssertNoTilesRequired(pending_layer_->HighResTiling());
1807 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1863 AssertNoTilesRequired(pending_layer_->LowResTiling());
1808 } 1864 }
1809 1865
1810 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { 1866 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) {
1811 gfx::Size layer_bounds(400, 400); 1867 gfx::Size layer_bounds(400, 400);
1812 gfx::Size tile_size(100, 100); 1868 gfx::Size tile_size(100, 100);
1813 scoped_refptr<FakePicturePileImpl> pending_pile = 1869 scoped_refptr<FakePicturePileImpl> pending_pile =
1814 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1870 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1815 scoped_refptr<FakePicturePileImpl> active_pile = 1871 scoped_refptr<FakePicturePileImpl> active_pile =
1816 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); 1872 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
1817 SetupTrees(pending_pile, active_pile); 1873 SetupTrees(pending_pile, active_pile);
1818 pending_layer_->set_fixed_tile_size(tile_size); 1874 pending_layer_->set_fixed_tile_size(tile_size);
1819 active_layer_->set_fixed_tile_size(tile_size); 1875 active_layer_->set_fixed_tile_size(tile_size);
1820 1876
1821 CreateHighLowResAndSetAllTilesVisible(); 1877 CreateHighLowResAndSetAllTilesVisible();
1822 1878
1823 // Active layer can't have tiles. 1879 // Active layer can't have tiles.
1824 EXPECT_FALSE(active_layer_->CanHaveTilings()); 1880 EXPECT_FALSE(active_layer_->CanHaveTilings());
1825 1881
1826 // All high res tiles required. This should be considered identical 1882 // All high res tiles required. This should be considered identical
1827 // to the case where there is no active layer, to avoid flashing content. 1883 // to the case where there is no active layer, to avoid flashing content.
1828 // This can happen if a layer exists for a while and switches from 1884 // This can happen if a layer exists for a while and switches from
1829 // not being able to have content to having content. 1885 // not being able to have content to having content.
1830 pending_layer_->MarkVisibleResourcesAsRequired(); 1886 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1887 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1888
1831 AssertAllTilesRequired(pending_layer_->HighResTiling()); 1889 AssertAllTilesRequired(pending_layer_->HighResTiling());
1832 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1890 AssertNoTilesRequired(pending_layer_->LowResTiling());
1833 } 1891 }
1834 1892
1835 TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { 1893 TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) {
1836 gfx::Size layer_bounds(200, 200); 1894 gfx::Size layer_bounds(200, 200);
1837 gfx::Size tile_size(100, 100); 1895 gfx::Size tile_size(100, 100);
1838 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 1896 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
1839 1897
1840 gfx::Size pending_layer_bounds(400, 400); 1898 gfx::Size pending_layer_bounds(400, 400);
1841 pending_layer_->SetBounds(pending_layer_bounds); 1899 pending_layer_->SetBounds(pending_layer_bounds);
1842 1900
1843 CreateHighLowResAndSetAllTilesVisible(); 1901 CreateHighLowResAndSetAllTilesVisible();
1902 // TODO(vmpstr): This is confusing. Rework the test to create different bounds
1903 // on different trees instead of fudging tilings.
1904 pending_layer_->HighResTiling()->ComputeTilePriorityRects(
1905 PENDING_TREE, gfx::Rect(pending_layer_bounds), 1.f, 1.f, Occlusion());
1844 1906
1907 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1845 active_layer_->SetAllTilesReady(); 1908 active_layer_->SetAllTilesReady();
1846 1909
1847 // Since the active layer has different bounds, the pending layer needs all 1910 // Since the active layer has different bounds, the pending layer needs all
1848 // high res tiles in order to activate. 1911 // high res tiles in order to activate.
1849 pending_layer_->MarkVisibleResourcesAsRequired(); 1912 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
1913 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
1914
1850 AssertAllTilesRequired(pending_layer_->HighResTiling()); 1915 AssertAllTilesRequired(pending_layer_->HighResTiling());
1851 AssertNoTilesRequired(pending_layer_->LowResTiling()); 1916 AssertNoTilesRequired(pending_layer_->LowResTiling());
1852 } 1917 }
1853 1918
1854 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { 1919 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
1855 gfx::Size tile_size(100, 100); 1920 gfx::Size tile_size(100, 100);
1856 gfx::Size layer_bounds(400, 400); 1921 gfx::Size layer_bounds(400, 400);
1857 scoped_refptr<FakePicturePileImpl> pending_pile = 1922 scoped_refptr<FakePicturePileImpl> pending_pile =
1858 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 1923 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
1859 1924
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 for (size_t i = 0; i < tilings.size(); ++i) { 2753 for (size_t i = 0; i < tilings.size(); ++i) {
2689 PictureLayerTiling* tiling = tilings.at(i); 2754 PictureLayerTiling* tiling = tilings.at(i);
2690 for (PictureLayerTiling::CoverageIterator iter( 2755 for (PictureLayerTiling::CoverageIterator iter(
2691 tiling, 2756 tiling,
2692 pending_layer_->contents_scale_x(), 2757 pending_layer_->contents_scale_x(),
2693 pending_layer_->visible_content_rect()); 2758 pending_layer_->visible_content_rect());
2694 iter; 2759 iter;
2695 ++iter) { 2760 ++iter) {
2696 if (mark_required) { 2761 if (mark_required) {
2697 number_of_marked_tiles++; 2762 number_of_marked_tiles++;
2698 iter->MarkRequiredForActivation(); 2763 iter->set_required_for_activation(true);
2699 } else { 2764 } else {
2700 number_of_unmarked_tiles++; 2765 number_of_unmarked_tiles++;
2701 } 2766 }
2702 mark_required = !mark_required; 2767 mark_required = !mark_required;
2703 } 2768 }
2704 } 2769 }
2705 2770
2706 // Sanity checks. 2771 // Sanity checks.
2707 EXPECT_EQ(91u, all_tiles.size()); 2772 EXPECT_EQ(91u, all_tiles.size());
2708 EXPECT_EQ(91u, all_tiles_set.size()); 2773 EXPECT_EQ(91u, all_tiles_set.size());
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2900 gfx::Size tile_size(100, 100); 2965 gfx::Size tile_size(100, 100);
2901 gfx::Size layer_bounds(1000, 1000); 2966 gfx::Size layer_bounds(1000, 1000);
2902 2967
2903 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 2968 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2904 2969
2905 // Make sure some tiles are not shared. 2970 // Make sure some tiles are not shared.
2906 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); 2971 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2907 2972
2908 CreateHighLowResAndSetAllTilesVisible(); 2973 CreateHighLowResAndSetAllTilesVisible();
2909 active_layer_->SetAllTilesReady(); 2974 active_layer_->SetAllTilesReady();
2910 pending_layer_->MarkVisibleResourcesAsRequired();
2911 2975
2912 // All pending layer tiles required are not ready. 2976 // All pending layer tiles required are not ready.
2913 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 2977 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2914 2978
2915 // Initialize all low-res tiles. 2979 // Initialize all low-res tiles.
2916 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); 2980 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
2917 2981
2918 // Low-res tiles should not be enough. 2982 // Low-res tiles should not be enough.
2919 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 2983 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2920 2984
2921 // Initialize remaining tiles. 2985 // Initialize remaining tiles.
2922 pending_layer_->SetAllTilesReady(); 2986 pending_layer_->SetAllTilesReady();
2923 2987
2924 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 2988 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2925 } 2989 }
2926 2990
2927 TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) { 2991 TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) {
2928 gfx::Size tile_size(100, 100); 2992 gfx::Size tile_size(100, 100);
2929 gfx::Size layer_bounds(1000, 1000); 2993 gfx::Size layer_bounds(1000, 1000);
2930 2994
2931 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 2995 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2932 2996
2933 // Make sure some tiles are not shared. 2997 // Make sure some tiles are not shared.
2934 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); 2998 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2935 2999
2936 CreateHighLowResAndSetAllTilesVisible(); 3000 CreateHighLowResAndSetAllTilesVisible();
2937 active_layer_->SetAllTilesReady(); 3001 active_layer_->SetAllTilesReady();
2938 pending_layer_->MarkVisibleResourcesAsRequired();
2939 3002
2940 // All pending layer tiles required are not ready. 3003 // All pending layer tiles required are not ready.
2941 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3004 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2942 3005
2943 // Initialize all high-res tiles. 3006 // Initialize all high-res tiles.
2944 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); 3007 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
2945 3008
2946 // High-res tiles should be enough, since they cover everything visible. 3009 // High-res tiles should be enough, since they cover everything visible.
2947 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3010 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2948 } 3011 }
2949 3012
2950 TEST_F(PictureLayerImplTest, 3013 TEST_F(PictureLayerImplTest,
2951 SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) { 3014 SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) {
2952 gfx::Size tile_size(100, 100); 3015 gfx::Size tile_size(100, 100);
2953 gfx::Size layer_bounds(1000, 1000); 3016 gfx::Size layer_bounds(1000, 1000);
2954 3017
2955 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 3018 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2956 3019
2957 // Make sure some tiles are not shared. 3020 // Make sure some tiles are not shared.
2958 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); 3021 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2959 3022
2960 CreateHighLowResAndSetAllTilesVisible(); 3023 CreateHighLowResAndSetAllTilesVisible();
2961 3024
2962 // Initialize all high-res tiles in the active layer. 3025 // Initialize all high-res tiles in the active layer.
2963 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); 3026 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
2964 // And all the low-res tiles in the pending layer. 3027 // And all the low-res tiles in the pending layer.
2965 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling()); 3028 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
2966 3029
2967 pending_layer_->MarkVisibleResourcesAsRequired();
2968
2969 // The unshared high-res tiles are not ready, so we cannot activate. 3030 // The unshared high-res tiles are not ready, so we cannot activate.
2970 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3031 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2971 3032
2972 // When the unshared pending high-res tiles are ready, we can activate. 3033 // When the unshared pending high-res tiles are ready, we can activate.
2973 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); 3034 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
2974 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3035 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2975 } 3036 }
2976 3037
2977 TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) { 3038 TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) {
2978 gfx::Size tile_size(100, 100); 3039 gfx::Size tile_size(100, 100);
2979 gfx::Size layer_bounds(1000, 1000); 3040 gfx::Size layer_bounds(1000, 1000);
2980 3041
2981 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 3042 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
2982 3043
2983 // Make sure some tiles are not shared. 3044 // Make sure some tiles are not shared.
2984 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); 3045 pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
2985 3046
2986 CreateHighLowResAndSetAllTilesVisible(); 3047 CreateHighLowResAndSetAllTilesVisible();
2987 3048
2988 // Initialize all high-res tiles in the active layer. 3049 // Initialize all high-res tiles in the active layer.
2989 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling()); 3050 active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
2990 3051
2991 pending_layer_->MarkVisibleResourcesAsRequired();
2992
2993 // The unshared high-res tiles are not ready, so we cannot activate. 3052 // The unshared high-res tiles are not ready, so we cannot activate.
2994 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3053 EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2995 3054
2996 // When the unshared pending high-res tiles are ready, we can activate. 3055 // When the unshared pending high-res tiles are ready, we can activate.
2997 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); 3056 pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
2998 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); 3057 EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
2999 } 3058 }
3000 3059
3001 class NoLowResPictureLayerImplTest : public PictureLayerImplTest { 3060 class NoLowResPictureLayerImplTest : public PictureLayerImplTest {
3002 public: 3061 public:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 7.26f, // ideal contents scale 3116 7.26f, // ideal contents scale
3058 2.2f, // device scale 3117 2.2f, // device scale
3059 3.3f, // page scale 3118 3.3f, // page scale
3060 1.f, // maximum animation scale 3119 1.f, // maximum animation scale
3061 false); 3120 false);
3062 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings()); 3121 ASSERT_EQ(3u, pending_layer_->tilings()->num_tilings());
3063 EXPECT_FLOAT_EQ(7.26f, 3122 EXPECT_FLOAT_EQ(7.26f,
3064 pending_layer_->tilings()->tiling_at(0)->contents_scale()); 3123 pending_layer_->tilings()->tiling_at(0)->contents_scale());
3065 } 3124 }
3066 3125
3067 TEST_F(NoLowResPictureLayerImplTest, MarkRequiredNullTiles) { 3126 TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfShared) {
3068 gfx::Size tile_size(100, 100);
3069 gfx::Size layer_bounds(1000, 1000);
3070
3071 scoped_refptr<FakePicturePileImpl> pending_pile =
3072 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
3073 // Layers with entirely empty piles can't get tilings.
3074 pending_pile->AddRecordingAt(0, 0);
3075
3076 SetupPendingTree(pending_pile);
3077
3078 ASSERT_TRUE(pending_layer_->CanHaveTilings());
3079 pending_layer_->AddTiling(1.0f);
3080 pending_layer_->AddTiling(2.0f);
3081
3082 // It should be safe to call this (and MarkVisibleResourcesAsRequired)
3083 // on a layer with no recordings.
3084 host_impl_.pending_tree()->UpdateDrawProperties();
3085 pending_layer_->MarkVisibleResourcesAsRequired();
3086 }
3087
3088 TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) {
3089 gfx::Size layer_bounds(400, 400); 3127 gfx::Size layer_bounds(400, 400);
3090 gfx::Size tile_size(100, 100); 3128 gfx::Size tile_size(100, 100);
3091 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); 3129 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
3092 3130
3093 CreateHighLowResAndSetAllTilesVisible(); 3131 CreateHighLowResAndSetAllTilesVisible();
3094 3132
3095 Tile* some_active_tile = 3133 Tile* some_active_tile =
3096 active_layer_->HighResTiling()->AllTilesForTesting()[0]; 3134 active_layer_->HighResTiling()->AllTilesForTesting()[0];
3097 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); 3135 EXPECT_FALSE(some_active_tile->IsReadyToDraw());
3098 3136
3099 // All tiles shared (no invalidation), so even though the active tree's 3137 // All tiles shared (no invalidation), so even though the active tree's
3100 // tiles aren't ready, there is nothing required. 3138 // tiles aren't ready, there is nothing required.
3101 pending_layer_->MarkVisibleResourcesAsRequired(); 3139 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
3102 AssertNoTilesRequired(pending_layer_->HighResTiling()); 3140 if (host_impl_.settings().create_low_res_tiling)
3103 if (host_impl_.settings().create_low_res_tiling) { 3141 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
3142
3143 AssertAllTilesRequired(pending_layer_->HighResTiling());
3144 if (host_impl_.settings().create_low_res_tiling)
3104 AssertNoTilesRequired(pending_layer_->LowResTiling()); 3145 AssertNoTilesRequired(pending_layer_->LowResTiling());
3105 }
3106 } 3146 }
3107 3147
3108 TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { 3148 TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
3109 gfx::Size layer_bounds(400, 400); 3149 gfx::Size layer_bounds(400, 400);
3110 gfx::Size tile_size(100, 100); 3150 gfx::Size tile_size(100, 100);
3111 scoped_refptr<FakePicturePileImpl> pending_pile = 3151 scoped_refptr<FakePicturePileImpl> pending_pile =
3112 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 3152 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
3113 // This pile will create tilings, but has no recordings so will not create any 3153 // This pile will create tilings, but has no recordings so will not create any
3114 // tiles. This is attempting to simulate scrolling past the end of recorded 3154 // tiles. This is attempting to simulate scrolling past the end of recorded
3115 // content on the active layer, where the recordings are so far away that 3155 // content on the active layer, where the recordings are so far away that
3116 // no tiles are created. 3156 // no tiles are created.
3117 scoped_refptr<FakePicturePileImpl> active_pile = 3157 scoped_refptr<FakePicturePileImpl> active_pile =
3118 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 3158 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
3119 tile_size, layer_bounds); 3159 tile_size, layer_bounds);
3120 SetupTrees(pending_pile, active_pile); 3160 SetupTrees(pending_pile, active_pile);
3121 pending_layer_->set_fixed_tile_size(tile_size); 3161 pending_layer_->set_fixed_tile_size(tile_size);
3122 active_layer_->set_fixed_tile_size(tile_size); 3162 active_layer_->set_fixed_tile_size(tile_size);
3123 3163
3124 CreateHighLowResAndSetAllTilesVisible(); 3164 CreateHighLowResAndSetAllTilesVisible();
3125 3165
3126 // Active layer has tilings, but no tiles due to missing recordings. 3166 // Active layer has tilings, but no tiles due to missing recordings.
3127 EXPECT_TRUE(active_layer_->CanHaveTilings()); 3167 EXPECT_TRUE(active_layer_->CanHaveTilings());
3128 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 3168 EXPECT_EQ(active_layer_->tilings()->num_tilings(),
3129 host_impl_.settings().create_low_res_tiling ? 2u : 1u); 3169 host_impl_.settings().create_low_res_tiling ? 2u : 1u);
3130 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u); 3170 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u);
3131 3171
3132 // Since the active layer has no tiles at all, the pending layer doesn't 3172 // Since the active layer has no tiles at all, the pending layer doesn't
3133 // need content in order to activate. 3173 // need content in order to activate.
3134 pending_layer_->MarkVisibleResourcesAsRequired(); 3174 pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
3175 if (host_impl_.settings().create_low_res_tiling)
3176 pending_layer_->LowResTiling()->UpdateAllTilePrioritiesForTesting();
3177
3135 AssertNoTilesRequired(pending_layer_->HighResTiling()); 3178 AssertNoTilesRequired(pending_layer_->HighResTiling());
3136 if (host_impl_.settings().create_low_res_tiling) 3179 if (host_impl_.settings().create_low_res_tiling)
3137 AssertNoTilesRequired(pending_layer_->LowResTiling()); 3180 AssertNoTilesRequired(pending_layer_->LowResTiling());
3138 } 3181 }
3139 3182
3140 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) { 3183 TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
3141 base::TimeTicks time_ticks; 3184 base::TimeTicks time_ticks;
3142 time_ticks += base::TimeDelta::FromMilliseconds(1); 3185 time_ticks += base::TimeDelta::FromMilliseconds(1);
3143 host_impl_.SetCurrentBeginFrameArgs( 3186 host_impl_.SetCurrentBeginFrameArgs(
3144 CreateBeginFrameArgsForTesting(time_ticks)); 3187 CreateBeginFrameArgsForTesting(time_ticks));
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 ++it) { 3751 ++it) {
3709 Tile* tile = *it; 3752 Tile* tile = *it;
3710 3753
3711 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); 3754 EXPECT_FALSE(tile->is_occluded(PENDING_TREE));
3712 3755
3713 bool tile_is_visible = 3756 bool tile_is_visible =
3714 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); 3757 tile->content_rect().Intersects(pending_layer_->visible_content_rect());
3715 if (tile_is_visible) 3758 if (tile_is_visible)
3716 unoccluded_tile_count++; 3759 unoccluded_tile_count++;
3717 } 3760 }
3718 EXPECT_EQ(unoccluded_tile_count, 20 + 2); 3761 EXPECT_EQ(20 + 2, unoccluded_tile_count);
3719 3762
3720 // Full occlusion. 3763 // Full occlusion.
3721 layer1->SetPosition(gfx::Point(0, 0)); 3764 layer1->SetPosition(gfx::Point(0, 0));
3722 3765
3723 time_ticks += base::TimeDelta::FromMilliseconds(200); 3766 time_ticks += base::TimeDelta::FromMilliseconds(200);
3724 host_impl_.SetCurrentBeginFrameArgs( 3767 host_impl_.SetCurrentBeginFrameArgs(
3725 CreateBeginFrameArgsForTesting(time_ticks)); 3768 CreateBeginFrameArgsForTesting(time_ticks));
3726 host_impl_.pending_tree()->UpdateDrawProperties(); 3769 host_impl_.pending_tree()->UpdateDrawProperties();
3727 3770
3728 unoccluded_tile_count = 0; 3771 unoccluded_tile_count = 0;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 layer1->SetContentsOpaque(true); 3839 layer1->SetContentsOpaque(true);
3797 layer1->SetPosition(occluding_layer_position); 3840 layer1->SetPosition(occluding_layer_position);
3798 3841
3799 time_ticks += base::TimeDelta::FromMilliseconds(200); 3842 time_ticks += base::TimeDelta::FromMilliseconds(200);
3800 host_impl_.SetCurrentBeginFrameArgs( 3843 host_impl_.SetCurrentBeginFrameArgs(
3801 CreateBeginFrameArgsForTesting(time_ticks)); 3844 CreateBeginFrameArgsForTesting(time_ticks));
3802 host_impl_.pending_tree()->UpdateDrawProperties(); 3845 host_impl_.pending_tree()->UpdateDrawProperties();
3803 3846
3804 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 3847 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
3805 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 3848 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
3849 tiling->UpdateAllTilePrioritiesForTesting();
3806 3850
3807 occluded_tile_count = 0; 3851 occluded_tile_count = 0;
3808 for (PictureLayerTiling::CoverageIterator iter( 3852 for (PictureLayerTiling::CoverageIterator iter(
3809 tiling, 3853 tiling,
3810 pending_layer_->contents_scale_x(), 3854 pending_layer_->contents_scale_x(),
3811 gfx::Rect(layer_bounds)); 3855 gfx::Rect(layer_bounds));
3812 iter; 3856 iter;
3813 ++iter) { 3857 ++iter) {
3814 if (!*iter) 3858 if (!*iter)
3815 continue; 3859 continue;
(...skipping 19 matching lines...) Expand all
3835 // Full occlusion. 3879 // Full occlusion.
3836 layer1->SetPosition(gfx::PointF(0, 0)); 3880 layer1->SetPosition(gfx::PointF(0, 0));
3837 3881
3838 time_ticks += base::TimeDelta::FromMilliseconds(200); 3882 time_ticks += base::TimeDelta::FromMilliseconds(200);
3839 host_impl_.SetCurrentBeginFrameArgs( 3883 host_impl_.SetCurrentBeginFrameArgs(
3840 CreateBeginFrameArgsForTesting(time_ticks)); 3884 CreateBeginFrameArgsForTesting(time_ticks));
3841 host_impl_.pending_tree()->UpdateDrawProperties(); 3885 host_impl_.pending_tree()->UpdateDrawProperties();
3842 3886
3843 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 3887 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
3844 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 3888 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
3889 tiling->UpdateAllTilePrioritiesForTesting();
3845 3890
3846 occluded_tile_count = 0; 3891 occluded_tile_count = 0;
3847 for (PictureLayerTiling::CoverageIterator iter( 3892 for (PictureLayerTiling::CoverageIterator iter(
3848 tiling, 3893 tiling,
3849 pending_layer_->contents_scale_x(), 3894 pending_layer_->contents_scale_x(),
3850 gfx::Rect(layer_bounds)); 3895 gfx::Rect(layer_bounds));
3851 iter; 3896 iter;
3852 ++iter) { 3897 ++iter) {
3853 if (!*iter) 3898 if (!*iter)
3854 continue; 3899 continue;
3855 const Tile* tile = *iter; 3900 const Tile* tile = *iter;
3856 3901
3857 if (tile->is_occluded(PENDING_TREE)) { 3902 if (tile->is_occluded(PENDING_TREE)) {
3858 EXPECT_FALSE(tile->required_for_activation()); 3903 EXPECT_FALSE(tile->required_for_activation());
3859 occluded_tile_count++; 3904 occluded_tile_count++;
3860 } 3905 }
3861 } 3906 }
3862 switch (i) { 3907 switch (i) {
3863 case 0: 3908 case 0:
3864 EXPECT_EQ(occluded_tile_count, 25); 3909 EXPECT_EQ(25, occluded_tile_count);
3865 break; 3910 break;
3866 case 1: 3911 case 1:
3867 EXPECT_EQ(occluded_tile_count, 4); 3912 EXPECT_EQ(4, occluded_tile_count);
3868 break; 3913 break;
3869 default: 3914 default:
3870 NOTREACHED(); 3915 NOTREACHED();
3871 } 3916 }
3872 } 3917 }
3873 } 3918 }
3874 3919
3875 TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { 3920 TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) {
3876 gfx::Size tile_size(102, 102); 3921 gfx::Size tile_size(102, 102);
3877 gfx::Size layer_bounds(1000, 1000); 3922 gfx::Size layer_bounds(1000, 1000);
(...skipping 26 matching lines...) Expand all
3904 3949
3905 host_impl_.SetViewportSize(viewport_size); 3950 host_impl_.SetViewportSize(viewport_size);
3906 host_impl_.pending_tree()->UpdateDrawProperties(); 3951 host_impl_.pending_tree()->UpdateDrawProperties();
3907 3952
3908 int tiling_count = 0; 3953 int tiling_count = 0;
3909 int occluded_tile_count = 0; 3954 int occluded_tile_count = 0;
3910 for (std::vector<PictureLayerTiling*>::iterator tiling_iterator = 3955 for (std::vector<PictureLayerTiling*>::iterator tiling_iterator =
3911 tilings.begin(); 3956 tilings.begin();
3912 tiling_iterator != tilings.end(); 3957 tiling_iterator != tilings.end();
3913 ++tiling_iterator) { 3958 ++tiling_iterator) {
3959 (*tiling_iterator)->UpdateAllTilePrioritiesForTesting();
3914 std::vector<Tile*> tiles = (*tiling_iterator)->AllTilesForTesting(); 3960 std::vector<Tile*> tiles = (*tiling_iterator)->AllTilesForTesting();
3915 3961
3916 occluded_tile_count = 0; 3962 occluded_tile_count = 0;
3917 for (size_t i = 0; i < tiles.size(); ++i) { 3963 for (size_t i = 0; i < tiles.size(); ++i) {
3918 if (tiles[i]->is_occluded(PENDING_TREE)) { 3964 if (tiles[i]->is_occluded(PENDING_TREE)) {
3919 gfx::Rect scaled_content_rect = ScaleToEnclosingRect( 3965 gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
3920 tiles[i]->content_rect(), 1.0f / tiles[i]->contents_scale()); 3966 tiles[i]->content_rect(), 1.0f / tiles[i]->contents_scale());
3921 EXPECT_GE(scaled_content_rect.x(), occluding_layer_position.x()); 3967 EXPECT_GE(scaled_content_rect.x(), occluding_layer_position.x());
3922 occluded_tile_count++; 3968 occluded_tile_count++;
3923 } 3969 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3971 // Partially invalidate the pending layer. 4017 // Partially invalidate the pending layer.
3972 pending_layer_->set_invalidation(invalidation_rect); 4018 pending_layer_->set_invalidation(invalidation_rect);
3973 4019
3974 host_impl_.SetViewportSize(viewport_size); 4020 host_impl_.SetViewportSize(viewport_size);
3975 4021
3976 active_layer_->CreateDefaultTilingsAndTiles(); 4022 active_layer_->CreateDefaultTilingsAndTiles();
3977 pending_layer_->CreateDefaultTilingsAndTiles(); 4023 pending_layer_->CreateDefaultTilingsAndTiles();
3978 4024
3979 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 4025 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
3980 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 4026 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
4027 tiling->UpdateAllTilePrioritiesForTesting();
3981 4028
3982 for (PictureLayerTiling::CoverageIterator iter( 4029 for (PictureLayerTiling::CoverageIterator iter(
3983 tiling, 4030 tiling,
3984 pending_layer_->contents_scale_x(), 4031 pending_layer_->contents_scale_x(),
3985 gfx::Rect(layer_bounds)); 4032 gfx::Rect(layer_bounds));
3986 iter; 4033 iter;
3987 ++iter) { 4034 ++iter) {
3988 if (!*iter) 4035 if (!*iter)
3989 continue; 4036 continue;
3990 const Tile* tile = *iter; 4037 const Tile* tile = *iter;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
4115 // The total expected number of occluded tiles on all tilings for each of the 4162 // The total expected number of occluded tiles on all tilings for each of the
4116 // 3 tree priorities. 4163 // 3 tree priorities.
4117 size_t total_expected_occluded_tile_count[] = {13u, 43u, 43u}; 4164 size_t total_expected_occluded_tile_count[] = {13u, 43u, 43u};
4118 4165
4119 ASSERT_EQ(arraysize(total_expected_occluded_tile_count), NUM_TREE_PRIORITIES); 4166 ASSERT_EQ(arraysize(total_expected_occluded_tile_count), NUM_TREE_PRIORITIES);
4120 4167
4121 // Verify number of occluded tiles on the pending layer for each tiling. 4168 // Verify number of occluded tiles on the pending layer for each tiling.
4122 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { 4169 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
4123 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); 4170 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i);
4124 tiling->CreateAllTilesForTesting(); 4171 tiling->CreateAllTilesForTesting();
4172 tiling->UpdateAllTilePrioritiesForTesting();
4125 4173
4126 size_t occluded_tile_count_on_pending = 0u; 4174 size_t occluded_tile_count_on_pending = 0u;
4127 size_t occluded_tile_count_on_active = 0u; 4175 size_t occluded_tile_count_on_active = 0u;
4128 size_t occluded_tile_count_on_both = 0u; 4176 size_t occluded_tile_count_on_both = 0u;
4129 for (PictureLayerTiling::CoverageIterator iter( 4177 for (PictureLayerTiling::CoverageIterator iter(
4130 tiling, 4178 tiling,
4131 pending_layer_->contents_scale_x(), 4179 pending_layer_->contents_scale_x(),
4132 gfx::Rect(layer_bounds)); 4180 gfx::Rect(layer_bounds));
4133 iter; 4181 iter;
4134 ++iter) { 4182 ++iter) {
(...skipping 14 matching lines...) Expand all
4149 << i; 4197 << i;
4150 EXPECT_EQ(expected_occluded_tile_count_on_both[i], 4198 EXPECT_EQ(expected_occluded_tile_count_on_both[i],
4151 occluded_tile_count_on_both) 4199 occluded_tile_count_on_both)
4152 << i; 4200 << i;
4153 } 4201 }
4154 4202
4155 // Verify number of occluded tiles on the active layer for each tiling. 4203 // Verify number of occluded tiles on the active layer for each tiling.
4156 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { 4204 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) {
4157 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); 4205 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i);
4158 tiling->CreateAllTilesForTesting(); 4206 tiling->CreateAllTilesForTesting();
4207 tiling->UpdateAllTilePrioritiesForTesting();
4159 4208
4160 size_t occluded_tile_count_on_pending = 0u; 4209 size_t occluded_tile_count_on_pending = 0u;
4161 size_t occluded_tile_count_on_active = 0u; 4210 size_t occluded_tile_count_on_active = 0u;
4162 size_t occluded_tile_count_on_both = 0u; 4211 size_t occluded_tile_count_on_both = 0u;
4163 for (PictureLayerTiling::CoverageIterator iter( 4212 for (PictureLayerTiling::CoverageIterator iter(
4164 tiling, 4213 tiling,
4165 pending_layer_->contents_scale_x(), 4214 pending_layer_->contents_scale_x(),
4166 gfx::Rect(layer_bounds)); 4215 gfx::Rect(layer_bounds));
4167 iter; 4216 iter;
4168 ++iter) { 4217 ++iter) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 SetupPendingTree(pending_pile2); 4419 SetupPendingTree(pending_pile2);
4371 ActivateTree(); 4420 ActivateTree();
4372 4421
4373 // We've switched to a solid color, so we should end up with no tilings. 4422 // We've switched to a solid color, so we should end up with no tilings.
4374 ASSERT_TRUE(active_layer_->tilings()); 4423 ASSERT_TRUE(active_layer_->tilings());
4375 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); 4424 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings());
4376 } 4425 }
4377 4426
4378 } // namespace 4427 } // namespace
4379 } // namespace cc 4428 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/memory_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698