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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 502453003: cc: Remove tiles from recycle tree that were deleted on active. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't maintain recycled twin Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8ccd54f37c3e02411aafee13f56dfc524b080aa4..f4187e9ace0d235fadfed218b7335898eef60fea 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -53,7 +53,10 @@ class PictureLayerImplTest : public testing::Test {
host_impl_(ImplSidePaintingSettings(),
&proxy_,
&shared_bitmap_manager_),
- id_(7) {}
+ id_(7),
+ pending_layer_(NULL),
+ old_pending_layer_(NULL),
+ active_layer_(NULL) {}
explicit PictureLayerImplTest(const LayerTreeSettings& settings)
: proxy_(base::MessageLoopProxy::current()),
@@ -86,6 +89,8 @@ class PictureLayerImplTest : public testing::Test {
void ActivateTree() {
host_impl_.ActivateSyncTree();
CHECK(!host_impl_.pending_tree());
+ CHECK(host_impl_.recycle_tree());
+ old_pending_layer_ = pending_layer_;
pending_layer_ = NULL;
active_layer_ = static_cast<FakePictureLayerImpl*>(
host_impl_.active_tree()->LayerById(id_));
@@ -266,6 +271,7 @@ class PictureLayerImplTest : public testing::Test {
FakeLayerTreeHostImpl host_impl_;
int id_;
FakePictureLayerImpl* pending_layer_;
+ FakePictureLayerImpl* old_pending_layer_;
FakePictureLayerImpl* active_layer_;
private:
@@ -4145,5 +4151,31 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
VerifyEvictionConsidersOcclusion(active_layer_,
total_expected_occluded_tile_count);
}
+
+TEST_F(PictureLayerImplTest, RecycledTwinLayer) {
+ gfx::Size tile_size(102, 102);
+ gfx::Size layer_bounds(1000, 1000);
+
+ scoped_refptr<FakePicturePileImpl> pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
+ SetupPendingTree(pile);
+ EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer());
+
+ ActivateTree();
+ EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
+ EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
+
+ SetupPendingTree(pile);
+ EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer());
+ EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
+
+ ActivateTree();
+ EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
+ EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
+
+ host_impl_.ResetRecycleTreeForTesting();
+ EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698