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

Unified Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 881083002: cc: Clean up tilings in UpdateTiles as well as in AppendQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 11 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
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 79dfec685dabe2c4001a7d7bc32e4c601ef33f02..e92ce0e2b8d02a6571b65f14fe9635c7f956d774 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -635,6 +635,7 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
ActivateTree();
// Add a non-shared tiling on the active tree.
PictureLayerTiling* tiling = active_layer_->AddTiling(3.f);
+ active_layer_->AddUsedTiling(tiling);
tiling->CreateAllTilesForTesting();
// Then setup a new pending tree and activate it.
SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50),
@@ -916,8 +917,10 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, false);
EXPECT_BOTH_EQ(num_tilings(), 2u);
EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), 2.f);
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0));
danakj 2015/01/27 21:56:59 Maybe a MarkAllTilingsUsed() and MarkTilingUsed(Ti
vmpstr 2015/01/27 22:53:59 Done.
EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(),
2.f * low_res_factor);
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
// Start a pinch gesture.
host_impl_.PinchGestureBegin();
@@ -930,6 +933,7 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
active_layer_->tilings()->tiling_at(0)->contents_scale());
EXPECT_FLOAT_EQ(1.0f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
EXPECT_FLOAT_EQ(2.0f * low_res_factor,
active_layer_->tilings()->tiling_at(2)->contents_scale());
@@ -966,8 +970,10 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(0.24f,
active_layer_->tilings()->tiling_at(0)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0));
EXPECT_FLOAT_EQ(0.0625f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
// Start a pinch gesture.
host_impl_.PinchGestureBegin();
@@ -980,6 +986,7 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
active_layer_->tilings()->tiling_at(0)->contents_scale());
EXPECT_FLOAT_EQ(0.12f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
EXPECT_FLOAT_EQ(0.0625,
active_layer_->tilings()->tiling_at(2)->contents_scale());
@@ -1021,6 +1028,8 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
SetupTrees(pending_pile, active_pile);
EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->HighResTiling());
+ active_layer_->AddUsedTiling(active_layer_->LowResTiling());
// We only have ideal tilings, so they aren't removed.
used_tilings.clear();
@@ -1050,9 +1059,11 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
EXPECT_FLOAT_EQ(
1.f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
EXPECT_FLOAT_EQ(
1.f * low_res_factor,
active_layer_->tilings()->tiling_at(3)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(3));
// Mark the non-ideal tilings as used. They won't be removed.
used_tilings.clear();
@@ -1143,7 +1154,9 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
maximum_animation_scale,
animating_transform);
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
+ active_layer_->AddUsedTiling(active_layer_->HighResTiling());
EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
+ active_layer_->AddUsedTiling(active_layer_->LowResTiling());
EXPECT_BOTH_EQ(num_tilings(), 2u);
// Page scale animation, new high res, but no low res. We still have
@@ -3611,6 +3624,7 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false);
ASSERT_EQ(1u, active_layer_->tilings()->num_tilings());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(0));
// We only have ideal tilings, so they aren't removed.
used_tilings.clear();
@@ -3639,6 +3653,7 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
EXPECT_FLOAT_EQ(1.f,
active_layer_->tilings()->tiling_at(1)->contents_scale());
+ active_layer_->AddUsedTiling(active_layer_->tilings()->tiling_at(1));
// Mark the non-ideal tilings as used. They won't be removed.
used_tilings.clear();

Powered by Google App Engine
This is Rietveld 408576698