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