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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 799463005: cc: Mirror LiveTilesRect and tiles between active and recycled trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noswap-ltr: withcheck Created 6 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer_impl_unittest.cc
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index b9d3060257a1a80a7d30ce350c34d2e19418b374..88821fd55ba6de9e29217e9bf602ffcce0ee67f0 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -4548,6 +4548,66 @@ TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
}
+TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(400, 400);
+
+ scoped_refptr<FakePicturePileImpl> filled_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ scoped_refptr<FakePicturePileImpl> partial_pile =
+ FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds);
+ for (int i = 1; i < partial_pile->tiling().num_tiles_x(); ++i) {
+ for (int j = 1; j < partial_pile->tiling().num_tiles_y(); ++j)
+ partial_pile->AddRecordingAt(i, j);
+ }
+
+ SetupPendingTreeWithFixedTileSize(filled_pile, tile_size, Region());
+ ActivateTree();
+
+ PictureLayerTiling* pending_tiling = old_pending_layer_->HighResTiling();
+ PictureLayerTiling* active_tiling = active_layer_->HighResTiling();
+
+ // We should have all tiles in both tile sets.
+ EXPECT_EQ(5u * 5u, pending_tiling->AllTilesForTesting().size());
+ EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
+
+ // Now put a partially-recorded pile on the pending tree (and invalidate
+ // everything, since the main thread PicturePile will invalidate dropped
+ // recordings). This will cause us to be missing some tiles.
+ SetupPendingTreeWithFixedTileSize(partial_pile, tile_size,
+ Region(gfx::Rect(layer_bounds)));
+ EXPECT_EQ(3u * 3u, pending_tiling->AllTilesForTesting().size());
+ EXPECT_FALSE(pending_tiling->TileAt(0, 0));
+ EXPECT_FALSE(pending_tiling->TileAt(1, 1));
+ EXPECT_TRUE(pending_tiling->TileAt(2, 2));
+
+ // Active is not affected yet.
+ EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
+
+ // Activate the tree. The same tiles go missing on the active tree.
+ ActivateTree();
+ EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size());
+ EXPECT_FALSE(active_tiling->TileAt(0, 0));
+ EXPECT_FALSE(active_tiling->TileAt(1, 1));
+ EXPECT_TRUE(active_tiling->TileAt(2, 2));
+
+ // Now put a full recording on the pending tree again. We'll get all our tiles
+ // back.
+ SetupPendingTreeWithFixedTileSize(filled_pile, tile_size,
+ Region(gfx::Rect(layer_bounds)));
+ EXPECT_EQ(5u * 5u, pending_tiling->AllTilesForTesting().size());
+
+ // Active is not affected yet.
+ EXPECT_EQ(3u * 3u, active_tiling->AllTilesForTesting().size());
+
+ // Activate the tree. The tiles are created and shared on the active tree.
+ ActivateTree();
+ EXPECT_EQ(5u * 5u, active_tiling->AllTilesForTesting().size());
+ EXPECT_TRUE(active_tiling->TileAt(0, 0)->is_shared());
+ EXPECT_TRUE(active_tiling->TileAt(1, 1)->is_shared());
+ EXPECT_TRUE(active_tiling->TileAt(2, 2)->is_shared());
+}
+
class TileSizeSettings : public ImplSidePaintingSettings {
public:
TileSizeSettings() {

Powered by Google App Engine
This is Rietveld 408576698