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

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

Issue 1474853002: cc: Stop locking the raster scale factor at 1 after any change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | 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 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 // Ensure UpdateTiles won't remove any tilings. 1165 // Ensure UpdateTiles won't remove any tilings.
1166 active_layer_->MarkAllTilingsUsed(); 1166 active_layer_->MarkAllTilingsUsed();
1167 1167
1168 // Mark the non-ideal tilings as used. They won't be removed. 1168 // Mark the non-ideal tilings as used. They won't be removed.
1169 used_tilings.clear(); 1169 used_tilings.clear();
1170 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); 1170 used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
1171 used_tilings.push_back(active_layer_->tilings()->tiling_at(3)); 1171 used_tilings.push_back(active_layer_->tilings()->tiling_at(3));
1172 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 1172 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1173 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings()); 1173 ASSERT_EQ(4u, active_layer_->tilings()->num_tilings());
1174 1174
1175 // Now move the ideal scale to 0.5. Our target stays 1.2. 1175 // Now move the ideal scale to 0.5.
1176 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false); 1176 SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false);
1177 ASSERT_EQ(6u, active_layer_->tilings()->num_tilings());
1177 1178
1178 // The high resolution tiling is between target and ideal, so is not 1179 // And begin an animation to 1.2. There are now 3 tilings, 0.5, 1.0 and 1.2.
1179 // removed. The low res tiling for the old ideal=1.0 scale is removed. 1180 // The the 0.5 is ideal, but the 1.2 is high res. 1.0 sits between them.
1181 // high-res tiling is in the middle. There are also ex-low-res tilings paired
1182 // with each of the 3 tilings mentioned here, but since we're animating none
enne (OOO) 2015/11/24 22:05:30 Maybe offtopic, but do we really need these low re
danakj 2015/11/24 22:06:58 They get cleaned up by CleanUpTilingsOnActiveLayer
1183 // are marked as LOW_RESOLUTION.
1184 SetContentsScaleOnBothLayers(0.5, 1.f, page_scale, 1.2f, 0.f, true);
1185 ASSERT_EQ(6u, active_layer_->tilings()->num_tilings());
1186 EXPECT_EQ(HIGH_RESOLUTION,
1187 active_layer_->tilings()->tiling_at(0)->resolution());
1188 EXPECT_EQ(1.2f, // High-res, though not the ideal scale.
1189 active_layer_->tilings()->tiling_at(0)->contents_scale());
1190 EXPECT_EQ(1.f, // Tiling in the middle attack.
1191 active_layer_->tilings()->tiling_at(1)->contents_scale());
1192 EXPECT_EQ(0.5f, // Ideal scale, but not considered high-res.
1193 active_layer_->tilings()->tiling_at(2)->contents_scale());
1194
1195 EXPECT_EQ(NON_IDEAL_RESOLUTION,
1196 active_layer_->tilings()->tiling_at(1)->resolution());
1197 EXPECT_EQ(NON_IDEAL_RESOLUTION,
1198 active_layer_->tilings()->tiling_at(2)->resolution());
1199 EXPECT_EQ(NON_IDEAL_RESOLUTION,
1200 active_layer_->tilings()->tiling_at(3)->resolution());
1201 EXPECT_EQ(NON_IDEAL_RESOLUTION,
1202 active_layer_->tilings()->tiling_at(4)->resolution());
1203 EXPECT_EQ(NON_IDEAL_RESOLUTION,
1204 active_layer_->tilings()->tiling_at(5)->resolution());
1205
1206 EXPECT_EQ(1.2f * low_res_factor, // Low-res, paired with current high-res.
1207 active_layer_->tilings()->tiling_at(3)->contents_scale());
vmpstr 2015/11/24 22:14:40 Out of curiosity, why is the low res pair of the H
danakj 2015/11/24 22:16:20 Right, the true on line 1184 is animation. The com
1208 EXPECT_EQ(1.f * low_res_factor, // Ex-low-res, paired with the middle one.
1209 active_layer_->tilings()->tiling_at(4)->contents_scale());
1210 EXPECT_EQ(0.5f * low_res_factor, // Ex-low-res, paired with current ideal.
1211 active_layer_->tilings()->tiling_at(5)->contents_scale());
1212
1213 // The high resolution tiling is between target and ideal, so is not removed.
1214 // The ex-low-res tilings are all smaller scale, so they are removed.
1180 used_tilings.clear(); 1215 used_tilings.clear();
1181 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 1216 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1182 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 1217 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
1183 1218
1184 // Now move the ideal scale to 1.0. Our target stays 1.2. 1219 // Now move the ideal scale to 1.0 on the active layer. The high-res tiling
1185 SetContentsScaleOnBothLayers(1.f, 1.f, page_scale, 1.f, 0.f, false); 1220 // stays 1.2.
1221 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, page_scale, 1.2f,
1222 0.f, true);
1186 1223
1187 // All the tilings are between are target and the ideal, so they are not 1224 // All the tilings are between are target and the ideal, so they are not
1188 // removed. 1225 // Because the pending layer's ideal scale is still 0.5, all tilings fall
1226 // in the range [0.5,1.2] and are kept.
1189 used_tilings.clear(); 1227 used_tilings.clear();
1190 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 1228 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1191 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 1229 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
1192 1230
1193 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. 1231 // Move the ideal scale on the pending layer to 1.0 as well. Our high-res
1194 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.1f, 1.f, page_scale, 1.f, 1232 // stays 1.2 still.
1233 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, page_scale, 1.f,
1195 0.f, false); 1234 0.f, false);
1196 1235
1197 // Because the pending layer's ideal scale is still 1.0, our tilings fall 1236 // Our 0.5 tiling now falls outside the range between our ideal scale and our
1198 // in the range [1.0,1.2] and are kept. 1237 // high-res raster scale. But it is in our used tilings set, so nothing is
1238 // deleted.
1199 used_tilings.clear(); 1239 used_tilings.clear();
1240 used_tilings.push_back(active_layer_->tilings()->tiling_at(2));
1200 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 1241 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1201 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings()); 1242 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
1202 1243
1203 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays
1204 // 1.2 still.
1205 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.1f, 1.f, page_scale, 1.f,
1206 0.f, false);
1207
1208 // Our 1.0 tiling now falls outside the range between our ideal scale and our
1209 // target raster scale. But it is in our used tilings set, so nothing is
1210 // deleted.
1211 used_tilings.clear();
1212 used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
1213 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1214 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
1215
1216 // If we remove it from our used tilings set, it is outside the range to keep 1244 // If we remove it from our used tilings set, it is outside the range to keep
1217 // so it is deleted. 1245 // so it is deleted.
1218 used_tilings.clear(); 1246 used_tilings.clear();
1219 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 1247 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
1220 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 1248 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
1221 } 1249 }
1222 1250
1223 TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { 1251 TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
1224 // Make sure this layer covers multiple tiles, since otherwise low 1252 // Make sure this layer covers multiple tiles, since otherwise low
1225 // res won't get created because it is too small. 1253 // res won't get created because it is too small.
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2050
2023 TEST_F(PictureLayerImplTest, 2051 TEST_F(PictureLayerImplTest,
2024 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) { 2052 HighResAndIdealResTileIsCompleteWhenRasterScaleIsNotIdeal) {
2025 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 2053 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
2026 2054
2027 gfx::Size tile_size(100, 100); 2055 gfx::Size tile_size(100, 100);
2028 gfx::Size layer_bounds(200, 200); 2056 gfx::Size layer_bounds(200, 200);
2029 gfx::Size viewport_size(400, 400); 2057 gfx::Size viewport_size(400, 400);
2030 2058
2031 host_impl_.SetViewportSize(viewport_size); 2059 host_impl_.SetViewportSize(viewport_size);
2060
2061 // Start with an ideal and raster contents scale of 2.
2032 SetInitialDeviceScaleFactor(2.f); 2062 SetInitialDeviceScaleFactor(2.f);
2033
2034 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); 2063 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region());
2035 2064
2036 // One ideal tile exists, this will get used when drawing. 2065 // One ideal tile exists, this will get used when drawing.
2037 std::vector<Tile*> ideal_tiles; 2066 std::vector<Tile*> ideal_tiles;
2038 EXPECT_EQ(2.f, active_layer_->HighResTiling()->contents_scale()); 2067 EXPECT_EQ(2.f, active_layer_->HighResTiling()->contents_scale());
2039 ideal_tiles.push_back(active_layer_->HighResTiling()->TileAt(0, 0)); 2068 ideal_tiles.push_back(active_layer_->HighResTiling()->TileAt(0, 0));
2040 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 2069 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
2041 ideal_tiles); 2070 ideal_tiles);
2042 2071
2043 // Due to layer scale throttling, the raster contents scale is changed to 1, 2072 // Due to the animation, the raster contents scale moves to 1, while the
2044 // while the ideal is still 2. 2073 // ideal will still be 2.
2045 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
2046 false);
2047 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.f, 1.f, 1.f, 1.f, 0.f, 2074 SetupDrawPropertiesAndUpdateTiles(active_layer_, 2.f, 1.f, 1.f, 1.f, 0.f,
2048 false); 2075 true);
2049 2076
2050 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale()); 2077 EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
2051 EXPECT_EQ(1.f, active_layer_->raster_contents_scale()); 2078 EXPECT_EQ(1.f, active_layer_->raster_contents_scale());
2052 EXPECT_EQ(2.f, active_layer_->ideal_contents_scale()); 2079 EXPECT_EQ(2.f, active_layer_->ideal_contents_scale());
2053 2080
2054 // Both tilings still exist. 2081 // Both tilings still exist.
2082 ASSERT_GE(active_layer_->tilings()->num_tilings(), 2u);
2055 EXPECT_EQ(2.f, active_layer_->tilings()->tiling_at(0)->contents_scale()); 2083 EXPECT_EQ(2.f, active_layer_->tilings()->tiling_at(0)->contents_scale());
2056 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale()); 2084 EXPECT_EQ(1.f, active_layer_->tilings()->tiling_at(1)->contents_scale());
2057 2085
2058 // All high res tiles have resources. 2086 // All high res tiles have resources.
2059 std::vector<Tile*> high_tiles = 2087 std::vector<Tile*> high_tiles =
2060 active_layer_->HighResTiling()->AllTilesForTesting(); 2088 active_layer_->HighResTiling()->AllTilesForTesting();
2061 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles); 2089 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(high_tiles);
2062 2090
2063 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 2091 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
2064 AppendQuadsData data; 2092 AppendQuadsData data;
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 float page_scale = 1.f; 3343 float page_scale = 1.f;
3316 float maximum_animation_scale = 1.f; 3344 float maximum_animation_scale = 1.f;
3317 float starting_animation_scale = 0.f; 3345 float starting_animation_scale = 0.f;
3318 bool animating_transform = false; 3346 bool animating_transform = false;
3319 3347
3320 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, 3348 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
3321 maximum_animation_scale, 3349 maximum_animation_scale,
3322 starting_animation_scale, animating_transform); 3350 starting_animation_scale, animating_transform);
3323 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); 3351 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f);
3324 3352
3325 // Changing the source scale without being in an animation will cause 3353 // Changing the source scale without being in an animation should be
3326 // the layer to reset its source scale to 1.f. 3354 // immediately honored.
3327 contents_scale = 3.f; 3355 contents_scale = 3.f;
3328 3356
3329 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, 3357 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
3330 maximum_animation_scale, 3358 maximum_animation_scale,
3331 starting_animation_scale, animating_transform); 3359 starting_animation_scale, animating_transform);
3332 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 3360 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f);
3333 3361
3334 // Further changes to the source scale will no longer be reflected in the 3362 // Further changes to the source scale will continue to be honored.
3335 // contents scale.
3336 contents_scale = 0.5f; 3363 contents_scale = 0.5f;
3337 3364
3338 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, 3365 SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale,
3339 maximum_animation_scale, 3366 maximum_animation_scale,
3340 starting_animation_scale, animating_transform); 3367 starting_animation_scale, animating_transform);
3341 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); 3368 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f);
3342 } 3369 }
3343 3370
3344 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { 3371 TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
3345 gfx::Size tile_size(100, 100); 3372 gfx::Size tile_size(100, 100);
3346 gfx::Size layer_bounds(1000, 1000); 3373 gfx::Size layer_bounds(1000, 1000);
3347 3374
3348 // Make sure pending tree has tiles. 3375 // Make sure pending tree has tiles.
3349 gfx::Rect invalidation(gfx::Point(50, 50), tile_size); 3376 gfx::Rect invalidation(gfx::Point(50, 50), tile_size);
3350 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation); 3377 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation);
3351 3378
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 3728
3702 // Ensure UpdateTiles won't remove any tilings. 3729 // Ensure UpdateTiles won't remove any tilings.
3703 active_layer_->MarkAllTilingsUsed(); 3730 active_layer_->MarkAllTilingsUsed();
3704 3731
3705 // Mark the non-ideal tilings as used. They won't be removed. 3732 // Mark the non-ideal tilings as used. They won't be removed.
3706 used_tilings.clear(); 3733 used_tilings.clear();
3707 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); 3734 used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
3708 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 3735 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3709 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 3736 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
3710 3737
3711 // Now move the ideal scale to 0.5. Our target stays 1.2. 3738 // Now move the ideal scale to 0.5.
3712 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, 0.f, false); 3739 SetContentsScaleOnBothLayers(0.5f, device_scale, page_scale, 1.f, 0.f, false);
3740 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
3741
3742 // And begin an animation to 1.2. There are now 3 tilings, 0.5, 1.0 and 1.2.
3743 // The the 0.5 is ideal, but the 1.2 is high res. 1.0 sits between them.
3744 // high-res tiling is in the middle.
3745 SetContentsScaleOnBothLayers(0.5, device_scale, page_scale, 1.2f, 0.f, true);
3746 EXPECT_EQ(HIGH_RESOLUTION,
3747 active_layer_->tilings()->tiling_at(0)->resolution());
3748 EXPECT_EQ(1.2f, // High-res, though not the ideal scale.
3749 active_layer_->tilings()->tiling_at(0)->contents_scale());
3750 EXPECT_EQ(1.f, // Tiling in the middle attack.
3751 active_layer_->tilings()->tiling_at(1)->contents_scale());
3752 EXPECT_EQ(0.5f, // Ideal scale, but not considered high-res.
3753 active_layer_->tilings()->tiling_at(2)->contents_scale());
3713 3754
3714 // The high resolution tiling is between target and ideal, so is not 3755 // The high resolution tiling is between target and ideal, so is not
3715 // removed. The low res tiling for the old ideal=1.0 scale is removed.
3716 used_tilings.clear();
3717 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3718 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
3719
3720 // Now move the ideal scale to 1.0. Our target stays 1.2.
3721 SetContentsScaleOnBothLayers(1.f, device_scale, page_scale, 1.f, 0.f, false);
3722
3723 // All the tilings are between are target and the ideal, so they are not
3724 // removed. 3756 // removed.
3725 used_tilings.clear(); 3757 used_tilings.clear();
3726 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 3758 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3727 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 3759 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
3728 3760
3729 // Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. 3761 // Now move the ideal scale to 1.0 on the active layer. The high-res tiling
3730 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.1f, device_scale, 3762 // stays 1.2.
3763 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, device_scale,
3764 page_scale, 1.2f, 0.f, true);
3765
3766 // Because the pending layer's ideal scale is still 0.5, all tilings fall
3767 // in the range [0.5,1.2] and are kept.
3768 used_tilings.clear();
3769 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3770 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
3771
3772 // Move the ideal scale on the pending layer to 1.0 as well. Our high-res
3773 // stays 1.2 still.
3774 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, device_scale,
3731 page_scale, 1.f, 0.f, false); 3775 page_scale, 1.f, 0.f, false);
3732 3776
3733 // Because the pending layer's ideal scale is still 1.0, our tilings fall 3777 // Our 0.5 tiling now falls outside the range between our ideal scale and our
3734 // in the range [1.0,1.2] and are kept. 3778 // high-res raster scale. But it is in our used tilings set, so nothing is
3735 used_tilings.clear();
3736 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3737 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
3738
3739 // Move the ideal scale on the pending layer to 1.1 as well. Our target stays
3740 // 1.2 still.
3741 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.1f, device_scale,
3742 page_scale, 1.f, 0.f, false);
3743
3744 // Our 1.0 tiling now falls outside the range between our ideal scale and our
3745 // target raster scale. But it is in our used tilings set, so nothing is
3746 // deleted. 3779 // deleted.
3747 used_tilings.clear(); 3780 used_tilings.clear();
3748 used_tilings.push_back(active_layer_->tilings()->tiling_at(1)); 3781 used_tilings.push_back(active_layer_->tilings()->tiling_at(2));
3749 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 3782 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3750 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings()); 3783 ASSERT_EQ(3u, active_layer_->tilings()->num_tilings());
3751 3784
3752 // If we remove it from our used tilings set, it is outside the range to keep 3785 // If we remove it from our used tilings set, it is outside the range to keep
3753 // so it is deleted. 3786 // so it is deleted.
3754 used_tilings.clear(); 3787 used_tilings.clear();
3755 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 3788 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
3756 ASSERT_EQ(1u, active_layer_->tilings()->num_tilings()); 3789 ASSERT_EQ(2u, active_layer_->tilings()->num_tilings());
3757 } 3790 }
3758 3791
3759 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) { 3792 TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) {
3760 gfx::Size layer_bounds(1300, 1900); 3793 gfx::Size layer_bounds(1300, 1900);
3761 SetupDefaultTrees(layer_bounds); 3794 SetupDefaultTrees(layer_bounds);
3762 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 3795 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
3763 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); 3796 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings());
3764 3797
3765 // All tilings should be removed when losing output surface. 3798 // All tilings should be removed when losing output surface.
3766 active_layer_->ReleaseResources(); 3799 active_layer_->ReleaseResources();
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
5042 // New low res tiling. 5075 // New low res tiling.
5043 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); 5076 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles());
5044 5077
5045 // This tiling will be high res now, it won't contain low res content since it 5078 // This tiling will be high res now, it won't contain low res content since it
5046 // was all destroyed. 5079 // was all destroyed.
5047 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); 5080 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles());
5048 } 5081 }
5049 5082
5050 } // namespace 5083 } // namespace
5051 } // namespace cc 5084 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698