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

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

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