| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/layers/picture_layer.h" | 10 #include "cc/layers/picture_layer.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void SetupTrees( | 86 void SetupTrees( |
| 87 scoped_refptr<PicturePileImpl> pending_pile, | 87 scoped_refptr<PicturePileImpl> pending_pile, |
| 88 scoped_refptr<PicturePileImpl> active_pile) { | 88 scoped_refptr<PicturePileImpl> active_pile) { |
| 89 SetupPendingTree(active_pile); | 89 SetupPendingTree(active_pile); |
| 90 ActivateTree(); | 90 ActivateTree(); |
| 91 SetupPendingTree(pending_pile); | 91 SetupPendingTree(pending_pile); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void CreateHighLowResAndSetAllTilesVisible() { | 94 void CreateHighLowResAndSetAllTilesVisible() { |
| 95 // Active layer must get updated first so pending layer can share from it. | 95 // Active layer must get updated first so pending layer can share from it. |
| 96 active_layer_->CreateDefaultTilingsAndTiles(); | 96 active_layer_->CreateDefaultTilingsAndTiles(ACTIVE_TREE); |
| 97 active_layer_->SetAllTilesVisible(); | 97 active_layer_->SetAllTilesVisible(); |
| 98 pending_layer_->CreateDefaultTilingsAndTiles(); | 98 pending_layer_->CreateDefaultTilingsAndTiles(PENDING_TREE); |
| 99 pending_layer_->SetAllTilesVisible(); | 99 pending_layer_->SetAllTilesVisible(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void AddDefaultTilingsWithInvalidation(const Region& invalidation) { | 102 void AddDefaultTilingsWithInvalidation(const Region& invalidation) { |
| 103 active_layer_->AddTiling(2.3f); | 103 active_layer_->AddTiling(2.3f); |
| 104 active_layer_->AddTiling(1.0f); | 104 active_layer_->AddTiling(1.0f); |
| 105 active_layer_->AddTiling(0.5f); | 105 active_layer_->AddTiling(0.5f); |
| 106 for (size_t i = 0; i < active_layer_->tilings()->num_tilings(); ++i) | 106 for (size_t i = 0; i < active_layer_->tilings()->num_tilings(); ++i) |
| 107 active_layer_->tilings()->tiling_at(i)->CreateAllTilesForTesting(); | 107 active_layer_->tilings()->tiling_at(i)->CreateAllActiveTilesForTesting(); |
| 108 pending_layer_->set_invalidation(invalidation); | 108 pending_layer_->set_invalidation(invalidation); |
| 109 for (size_t i = 0; i < pending_layer_->tilings()->num_tilings(); ++i) | 109 for (size_t i = 0; i < pending_layer_->tilings()->num_tilings(); ++i) { |
| 110 pending_layer_->tilings()->tiling_at(i)->CreateAllTilesForTesting(); | 110 pending_layer_->tilings() |
| 111 ->tiling_at(i) |
| 112 ->CreateAllPendingTilesForTesting(); |
| 113 } |
| 111 } | 114 } |
| 112 | 115 |
| 113 void SetupPendingTree( | 116 void SetupPendingTree( |
| 114 scoped_refptr<PicturePileImpl> pile) { | 117 scoped_refptr<PicturePileImpl> pile) { |
| 115 host_impl_.CreatePendingTree(); | 118 host_impl_.CreatePendingTree(); |
| 116 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 119 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| 117 // Clear recycled tree. | 120 // Clear recycled tree. |
| 118 pending_tree->DetachLayerTree(); | 121 pending_tree->DetachLayerTree(); |
| 119 | 122 |
| 120 scoped_ptr<FakePictureLayerImpl> pending_layer = | 123 scoped_ptr<FakePictureLayerImpl> pending_layer = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 &result_scale_x, | 164 &result_scale_x, |
| 162 &result_scale_y, | 165 &result_scale_y, |
| 163 &result_bounds); | 166 &result_bounds); |
| 164 } | 167 } |
| 165 | 168 |
| 166 void ResetTilingsAndRasterScales() { | 169 void ResetTilingsAndRasterScales() { |
| 167 pending_layer_->DidLoseOutputSurface(); | 170 pending_layer_->DidLoseOutputSurface(); |
| 168 active_layer_->DidLoseOutputSurface(); | 171 active_layer_->DidLoseOutputSurface(); |
| 169 } | 172 } |
| 170 | 173 |
| 171 void AssertAllTilesRequired(PictureLayerTiling* tiling) { | 174 void AssertAllTilesRequired(const std::vector<Tile*>& tiles) { |
| 172 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | |
| 173 for (size_t i = 0; i < tiles.size(); ++i) | 175 for (size_t i = 0; i < tiles.size(); ++i) |
| 174 EXPECT_TRUE(tiles[i]->required_for_activation()) << "i: " << i; | 176 EXPECT_TRUE(tiles[i]->required_for_activation()) << "i: " << i; |
| 175 EXPECT_GT(tiles.size(), 0u); | 177 EXPECT_GT(tiles.size(), 0u); |
| 176 } | 178 } |
| 177 | 179 |
| 178 void AssertNoTilesRequired(PictureLayerTiling* tiling) { | 180 void AssertNoTilesRequired(const std::vector<Tile*>& tiles) { |
| 179 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | |
| 180 for (size_t i = 0; i < tiles.size(); ++i) | 181 for (size_t i = 0; i < tiles.size(); ++i) |
| 181 EXPECT_FALSE(tiles[i]->required_for_activation()) << "i: " << i; | 182 EXPECT_FALSE(tiles[i]->required_for_activation()) << "i: " << i; |
| 182 EXPECT_GT(tiles.size(), 0u); | 183 EXPECT_GT(tiles.size(), 0u); |
| 183 } | 184 } |
| 184 | 185 |
| 185 protected: | 186 protected: |
| 186 void TestTileGridAlignmentCommon() { | 187 void TestTileGridAlignmentCommon() { |
| 187 // Layer to span 4 raster tiles in x and in y | 188 // Layer to span 4 raster tiles in x and in y |
| 188 ImplSidePaintingSettings settings; | 189 ImplSidePaintingSettings settings; |
| 189 gfx::Size layer_size( | 190 gfx::Size layer_size( |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 // Fake set priorities. | 1209 // Fake set priorities. |
| 1209 int tile_count = 0; | 1210 int tile_count = 0; |
| 1210 for (PictureLayerTiling::CoverageIterator iter( | 1211 for (PictureLayerTiling::CoverageIterator iter( |
| 1211 tiling, | 1212 tiling, |
| 1212 pending_layer_->contents_scale_x(), | 1213 pending_layer_->contents_scale_x(), |
| 1213 gfx::Rect(pending_layer_->visible_content_rect())); | 1214 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1214 iter; | 1215 iter; |
| 1215 ++iter) { | 1216 ++iter) { |
| 1216 if (!*iter) | 1217 if (!*iter) |
| 1217 continue; | 1218 continue; |
| 1218 Tile* tile = *iter; | |
| 1219 TilePriority priority; | 1219 TilePriority priority; |
| 1220 priority.resolution = HIGH_RESOLUTION; | 1220 priority.resolution = HIGH_RESOLUTION; |
| 1221 if (++tile_count % 2) { | 1221 if (++tile_count % 2) { |
| 1222 priority.time_to_visible_in_seconds = 0.f; | 1222 priority.time_to_visible_in_seconds = 0.f; |
| 1223 priority.distance_to_visible_in_pixels = 0.f; | 1223 priority.distance_to_visible_in_pixels = 0.f; |
| 1224 } else { | 1224 } else { |
| 1225 priority.time_to_visible_in_seconds = 1.f; | 1225 priority.time_to_visible_in_seconds = 1.f; |
| 1226 priority.distance_to_visible_in_pixels = 1.f; | 1226 priority.distance_to_visible_in_pixels = 1.f; |
| 1227 } | 1227 } |
| 1228 tile->SetPriority(PENDING_TREE, priority); | 1228 iter.SetPriorityForTesting(priority); |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 pending_layer_->MarkVisibleResourcesAsRequired(); | 1231 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1232 | 1232 |
| 1233 int num_visible = 0; | 1233 int num_visible = 0; |
| 1234 int num_offscreen = 0; | 1234 int num_offscreen = 0; |
| 1235 | 1235 |
| 1236 for (PictureLayerTiling::CoverageIterator iter( | 1236 for (PictureLayerTiling::CoverageIterator iter( |
| 1237 tiling, | 1237 tiling, |
| 1238 pending_layer_->contents_scale_x(), | 1238 pending_layer_->contents_scale_x(), |
| 1239 gfx::Rect(pending_layer_->visible_content_rect())); | 1239 gfx::Rect(pending_layer_->visible_content_rect())); |
| 1240 iter; | 1240 iter; |
| 1241 ++iter) { | 1241 ++iter) { |
| 1242 if (!*iter) | 1242 if (!*iter) |
| 1243 continue; | 1243 continue; |
| 1244 const Tile* tile = *iter; | 1244 const Tile* tile = *iter; |
| 1245 if (tile->priority(PENDING_TREE).distance_to_visible_in_pixels == 0.f) { | 1245 if (iter.priority().distance_to_visible_in_pixels == 0.f) { |
| 1246 EXPECT_TRUE(tile->required_for_activation()); | 1246 EXPECT_TRUE(tile->required_for_activation()); |
| 1247 num_visible++; | 1247 num_visible++; |
| 1248 } else { | 1248 } else { |
| 1249 EXPECT_FALSE(tile->required_for_activation()); | 1249 EXPECT_FALSE(tile->required_for_activation()); |
| 1250 num_offscreen++; | 1250 num_offscreen++; |
| 1251 } | 1251 } |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 EXPECT_GT(num_visible, 0); | 1254 EXPECT_GT(num_visible, 0); |
| 1255 EXPECT_GT(num_offscreen, 0); | 1255 EXPECT_GT(num_offscreen, 0); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { | 1258 TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
| 1259 gfx::Size layer_bounds(400, 400); | 1259 gfx::Size layer_bounds(400, 400); |
| 1260 gfx::Size tile_size(100, 100); | 1260 gfx::Size tile_size(100, 100); |
| 1261 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1261 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
| 1262 | 1262 |
| 1263 // No tiles shared. | 1263 // No tiles shared. |
| 1264 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); | 1264 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); |
| 1265 | 1265 |
| 1266 CreateHighLowResAndSetAllTilesVisible(); | 1266 CreateHighLowResAndSetAllTilesVisible(); |
| 1267 | 1267 |
| 1268 active_layer_->SetAllTilesReady(); | 1268 active_layer_->SetAllTilesReady(); |
| 1269 | 1269 |
| 1270 // No shared tiles and all active tiles ready, so pending can only | 1270 // No shared tiles and all active tiles ready, so pending can only |
| 1271 // activate with all high res tiles. | 1271 // activate with all high res tiles. |
| 1272 pending_layer_->MarkVisibleResourcesAsRequired(); | 1272 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1273 AssertAllTilesRequired(pending_layer_->HighResTiling()); | 1273 AssertAllTilesRequired( |
| 1274 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1274 pending_layer_->HighResTiling()->AllPendingTilesForTesting()); |
| 1275 AssertNoTilesRequired( |
| 1276 pending_layer_->LowResTiling()->AllPendingTilesForTesting()); |
| 1275 } | 1277 } |
| 1276 | 1278 |
| 1277 TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { | 1279 TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { |
| 1278 gfx::Size layer_bounds(400, 400); | 1280 gfx::Size layer_bounds(400, 400); |
| 1279 gfx::Size tile_size(100, 100); | 1281 gfx::Size tile_size(100, 100); |
| 1280 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1282 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
| 1281 | 1283 |
| 1282 CreateHighLowResAndSetAllTilesVisible(); | 1284 CreateHighLowResAndSetAllTilesVisible(); |
| 1283 | 1285 |
| 1284 Tile* some_active_tile = | 1286 Tile* some_active_tile = |
| 1285 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 1287 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
| 1286 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); | 1288 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); |
| 1287 | 1289 |
| 1288 // All tiles shared (no invalidation), so even though the active tree's | 1290 // All tiles shared (no invalidation), so even though the active tree's |
| 1289 // tiles aren't ready, there is nothing required. | 1291 // tiles aren't ready, there is nothing required. |
| 1290 pending_layer_->MarkVisibleResourcesAsRequired(); | 1292 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1291 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 1293 AssertNoTilesRequired( |
| 1292 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1294 pending_layer_->HighResTiling()->AllPendingTilesForTesting()); |
| 1295 AssertNoTilesRequired( |
| 1296 pending_layer_->LowResTiling()->AllPendingTilesForTesting()); |
| 1293 } | 1297 } |
| 1294 | 1298 |
| 1295 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { | 1299 TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { |
| 1296 gfx::Size layer_bounds(400, 400); | 1300 gfx::Size layer_bounds(400, 400); |
| 1297 gfx::Size tile_size(100, 100); | 1301 gfx::Size tile_size(100, 100); |
| 1298 scoped_refptr<FakePicturePileImpl> pending_pile = | 1302 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1299 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1303 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1300 // An arbitrary bogus outside the layer recording. Enough for the layer to | 1304 // An arbitrary bogus outside the layer recording. Enough for the layer to |
| 1301 // think it can create tiles, but not in bounds so all tiles are null. | 1305 // think it can create tiles, but not in bounds so all tiles are null. |
| 1302 Region active_recorded_region; | 1306 Region active_recorded_region; |
| 1303 active_recorded_region.Union(gfx::Rect(1000, 1000, 1, 1)); | 1307 active_recorded_region.Union(gfx::Rect(1000, 1000, 1, 1)); |
| 1304 scoped_refptr<FakePicturePileImpl> active_pile = | 1308 scoped_refptr<FakePicturePileImpl> active_pile = |
| 1305 FakePicturePileImpl::CreatePileWithRecordedRegion( | 1309 FakePicturePileImpl::CreatePileWithRecordedRegion( |
| 1306 tile_size, layer_bounds, active_recorded_region); | 1310 tile_size, layer_bounds, active_recorded_region); |
| 1307 SetupTrees(pending_pile, active_pile); | 1311 SetupTrees(pending_pile, active_pile); |
| 1308 pending_layer_->set_fixed_tile_size(tile_size); | 1312 pending_layer_->set_fixed_tile_size(tile_size); |
| 1309 active_layer_->set_fixed_tile_size(tile_size); | 1313 active_layer_->set_fixed_tile_size(tile_size); |
| 1310 | 1314 |
| 1311 CreateHighLowResAndSetAllTilesVisible(); | 1315 CreateHighLowResAndSetAllTilesVisible(); |
| 1312 | 1316 |
| 1313 // Active layer has tilings, but no tiles due to missing recordings. | 1317 // Active layer has tilings, but no tiles due to missing recordings. |
| 1314 EXPECT_TRUE(active_layer_->CanHaveTilings()); | 1318 EXPECT_TRUE(active_layer_->CanHaveTilings()); |
| 1315 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u); | 1319 EXPECT_EQ(active_layer_->tilings()->num_tilings(), 2u); |
| 1316 EXPECT_EQ(active_layer_->HighResTiling()->AllTilesForTesting().size(), 0u); | 1320 EXPECT_EQ(active_layer_->HighResTiling()->AllActiveTilesForTesting().size(), |
| 1321 0u); |
| 1317 | 1322 |
| 1318 // Since the active layer has no tiles at all, the pending layer doesn't | 1323 // Since the active layer has no tiles at all, the pending layer doesn't |
| 1319 // need content in order to activate. This is attempting to simulate | 1324 // need content in order to activate. This is attempting to simulate |
| 1320 // scrolling past the end of recorded content on the active layer. | 1325 // scrolling past the end of recorded content on the active layer. |
| 1321 pending_layer_->MarkVisibleResourcesAsRequired(); | 1326 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1322 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 1327 AssertNoTilesRequired( |
| 1323 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1328 pending_layer_->HighResTiling()->AllPendingTilesForTesting()); |
| 1329 AssertNoTilesRequired( |
| 1330 pending_layer_->LowResTiling()->AllPendingTilesForTesting()); |
| 1324 } | 1331 } |
| 1325 | 1332 |
| 1326 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { | 1333 TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { |
| 1327 gfx::Size layer_bounds(400, 400); | 1334 gfx::Size layer_bounds(400, 400); |
| 1328 gfx::Size tile_size(100, 100); | 1335 gfx::Size tile_size(100, 100); |
| 1329 scoped_refptr<FakePicturePileImpl> pending_pile = | 1336 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1330 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1337 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1331 scoped_refptr<FakePicturePileImpl> active_pile = | 1338 scoped_refptr<FakePicturePileImpl> active_pile = |
| 1332 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); | 1339 FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
| 1333 SetupTrees(pending_pile, active_pile); | 1340 SetupTrees(pending_pile, active_pile); |
| 1334 pending_layer_->set_fixed_tile_size(tile_size); | 1341 pending_layer_->set_fixed_tile_size(tile_size); |
| 1335 active_layer_->set_fixed_tile_size(tile_size); | 1342 active_layer_->set_fixed_tile_size(tile_size); |
| 1336 | 1343 |
| 1337 CreateHighLowResAndSetAllTilesVisible(); | 1344 CreateHighLowResAndSetAllTilesVisible(); |
| 1338 | 1345 |
| 1339 // Active layer can't have tiles. | 1346 // Active layer can't have tiles. |
| 1340 EXPECT_FALSE(active_layer_->CanHaveTilings()); | 1347 EXPECT_FALSE(active_layer_->CanHaveTilings()); |
| 1341 | 1348 |
| 1342 // All high res tiles required. This should be considered identical | 1349 // All high res tiles required. This should be considered identical |
| 1343 // to the case where there is no active layer, to avoid flashing content. | 1350 // to the case where there is no active layer, to avoid flashing content. |
| 1344 // This can happen if a layer exists for a while and switches from | 1351 // This can happen if a layer exists for a while and switches from |
| 1345 // not being able to have content to having content. | 1352 // not being able to have content to having content. |
| 1346 pending_layer_->MarkVisibleResourcesAsRequired(); | 1353 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1347 AssertAllTilesRequired(pending_layer_->HighResTiling()); | 1354 AssertAllTilesRequired( |
| 1348 AssertNoTilesRequired(pending_layer_->LowResTiling()); | 1355 pending_layer_->HighResTiling()->AllPendingTilesForTesting()); |
| 1356 AssertNoTilesRequired( |
| 1357 pending_layer_->LowResTiling()->AllPendingTilesForTesting()); |
| 1349 } | 1358 } |
| 1350 | 1359 |
| 1351 TEST_F(PictureLayerImplTest, LowResRequiredWhenMissingHighRes) { | 1360 TEST_F(PictureLayerImplTest, LowResRequiredWhenMissingHighRes) { |
| 1352 gfx::Size layer_bounds(400, 400); | 1361 gfx::Size layer_bounds(400, 400); |
| 1353 gfx::Size tile_size(100, 100); | 1362 gfx::Size tile_size(100, 100); |
| 1354 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); | 1363 SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
| 1355 | 1364 |
| 1356 // No tiles shared. | 1365 // No tiles shared. |
| 1357 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); | 1366 pending_layer_->set_invalidation(gfx::Rect(layer_bounds)); |
| 1358 | 1367 |
| 1359 CreateHighLowResAndSetAllTilesVisible(); | 1368 CreateHighLowResAndSetAllTilesVisible(); |
| 1360 | 1369 |
| 1361 // Only set the active low res tiles as being ready. | 1370 // Only set the active low res tiles as being ready. |
| 1362 active_layer_->SetAllTilesReadyInTiling(active_layer_->LowResTiling()); | 1371 active_layer_->SetAllTilesReadyInTiling(active_layer_->LowResTiling()); |
| 1363 // Verify high res not active. | 1372 // Verify high res not active. |
| 1364 Tile* some_active_tile = | 1373 Tile* some_active_tile = |
| 1365 active_layer_->HighResTiling()->AllTilesForTesting()[0]; | 1374 active_layer_->HighResTiling()->AllTilesForTesting()[0]; |
| 1366 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); | 1375 EXPECT_FALSE(some_active_tile->IsReadyToDraw()); |
| 1367 | 1376 |
| 1368 // Active layer's high res tiles aren't ready but low res ones are, so | 1377 // Active layer's high res tiles aren't ready but low res ones are, so |
| 1369 // the pending needs to at least have its low res tiles ready in order | 1378 // the pending needs to at least have its low res tiles ready in order |
| 1370 // to activate in order to not flash content. | 1379 // to activate in order to not flash content. |
| 1371 pending_layer_->MarkVisibleResourcesAsRequired(); | 1380 pending_layer_->MarkVisibleResourcesAsRequired(); |
| 1372 AssertNoTilesRequired(pending_layer_->HighResTiling()); | 1381 AssertNoTilesRequired( |
| 1373 AssertAllTilesRequired(pending_layer_->LowResTiling()); | 1382 pending_layer_->HighResTiling()->AllPendingTilesForTesting()); |
| 1383 AssertAllTilesRequired( |
| 1384 pending_layer_->LowResTiling()->AllPendingTilesForTesting()); |
| 1374 } | 1385 } |
| 1375 | 1386 |
| 1376 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { | 1387 TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { |
| 1377 gfx::Size tile_size(100, 100); | 1388 gfx::Size tile_size(100, 100); |
| 1378 gfx::Size layer_bounds(400, 400); | 1389 gfx::Size layer_bounds(400, 400); |
| 1379 scoped_refptr<FakePicturePileImpl> pending_pile = | 1390 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1380 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1391 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1381 | 1392 |
| 1382 host_impl_.CreatePendingTree(); | 1393 host_impl_.CreatePendingTree(); |
| 1383 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 1394 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 TestContextProvider::Create(), NULL)); | 1498 TestContextProvider::Create(), NULL)); |
| 1488 | 1499 |
| 1489 // These will crash PictureLayerImpl if this is not true. | 1500 // These will crash PictureLayerImpl if this is not true. |
| 1490 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); | 1501 ASSERT_TRUE(host_impl_.pending_tree()->needs_update_draw_properties()); |
| 1491 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); | 1502 ASSERT_TRUE(host_impl_.active_tree()->needs_update_draw_properties()); |
| 1492 host_impl_.active_tree()->UpdateDrawProperties(); | 1503 host_impl_.active_tree()->UpdateDrawProperties(); |
| 1493 } | 1504 } |
| 1494 | 1505 |
| 1495 } // namespace | 1506 } // namespace |
| 1496 } // namespace cc | 1507 } // namespace cc |
| OLD | NEW |