| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 EXPECT_NE(new_content_tiles, required_for_draw_tiles); | 347 EXPECT_NE(new_content_tiles, required_for_draw_tiles); |
| 348 } | 348 } |
| 349 | 349 |
| 350 TEST_F(TileManagerTilePriorityQueueTest, | 350 TEST_F(TileManagerTilePriorityQueueTest, |
| 351 RasterTilePriorityQueueHighNonIdealTilings) { | 351 RasterTilePriorityQueueHighNonIdealTilings) { |
| 352 const gfx::Size layer_bounds(1000, 1000); | 352 const gfx::Size layer_bounds(1000, 1000); |
| 353 const gfx::Size viewport(800, 800); | 353 const gfx::Size viewport(800, 800); |
| 354 host_impl()->SetViewportSize(viewport); | 354 host_impl()->SetViewportSize(viewport); |
| 355 SetupDefaultTrees(layer_bounds); | 355 SetupDefaultTrees(layer_bounds); |
| 356 | 356 |
| 357 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); | 357 pending_layer()->tilings()->AddTiling( |
| 358 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); | 358 ScaleTranslate2d(1.5f, gfx::Vector2dF()), |
| 359 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); | 359 pending_layer()->raster_source()); |
| 360 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); | 360 active_layer()->tilings()->AddTiling(ScaleTranslate2d(1.5f, gfx::Vector2dF()), |
| 361 active_layer()->raster_source()); |
| 362 pending_layer()->tilings()->AddTiling( |
| 363 ScaleTranslate2d(1.7f, gfx::Vector2dF()), |
| 364 pending_layer()->raster_source()); |
| 365 active_layer()->tilings()->AddTiling(ScaleTranslate2d(1.7f, gfx::Vector2dF()), |
| 366 active_layer()->raster_source()); |
| 361 | 367 |
| 362 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, | 368 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, |
| 363 5.0, Occlusion(), true); | 369 5.0, Occlusion(), true); |
| 364 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 370 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 365 Occlusion(), true); | 371 Occlusion(), true); |
| 366 | 372 |
| 367 std::set<Tile*> all_expected_tiles; | 373 std::set<Tile*> all_expected_tiles; |
| 368 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { | 374 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { |
| 369 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); | 375 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); |
| 370 if (tiling->contents_scale() == 1.f) { | 376 if (tiling->contents_scale_key() == 1.f) { |
| 371 tiling->set_resolution(HIGH_RESOLUTION); | 377 tiling->set_resolution(HIGH_RESOLUTION); |
| 372 const auto& all_tiles = tiling->AllTilesForTesting(); | 378 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 373 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 379 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 374 } else { | 380 } else { |
| 375 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 381 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 376 } | 382 } |
| 377 } | 383 } |
| 378 | 384 |
| 379 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { | 385 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { |
| 380 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); | 386 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); |
| 381 if (tiling->contents_scale() == 1.5f) { | 387 if (tiling->contents_scale_key() == 1.5f) { |
| 382 tiling->set_resolution(HIGH_RESOLUTION); | 388 tiling->set_resolution(HIGH_RESOLUTION); |
| 383 const auto& all_tiles = tiling->AllTilesForTesting(); | 389 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 384 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 390 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 385 } else { | 391 } else { |
| 386 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 392 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 387 // Non ideal tilings with a high res pending twin have to be processed | 393 // Non ideal tilings with a high res pending twin have to be processed |
| 388 // because of possible activation tiles. | 394 // because of possible activation tiles. |
| 389 if (tiling->contents_scale() == 1.f) { | 395 if (tiling->contents_scale_key() == 1.f) { |
| 390 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 396 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 391 const auto& all_tiles = tiling->AllTilesForTesting(); | 397 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 392 for (auto* tile : all_tiles) | 398 for (auto* tile : all_tiles) |
| 393 EXPECT_TRUE(tile->required_for_activation()); | 399 EXPECT_TRUE(tile->required_for_activation()); |
| 394 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 400 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 395 } | 401 } |
| 396 } | 402 } |
| 397 } | 403 } |
| 398 | 404 |
| 399 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( | 405 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 414 EXPECT_EQ(all_expected_tiles, all_actual_tiles); | 420 EXPECT_EQ(all_expected_tiles, all_actual_tiles); |
| 415 } | 421 } |
| 416 | 422 |
| 417 TEST_F(TileManagerTilePriorityQueueTest, | 423 TEST_F(TileManagerTilePriorityQueueTest, |
| 418 RasterTilePriorityQueueHighLowTilings) { | 424 RasterTilePriorityQueueHighLowTilings) { |
| 419 const gfx::Size layer_bounds(1000, 1000); | 425 const gfx::Size layer_bounds(1000, 1000); |
| 420 const gfx::Size viewport(800, 800); | 426 const gfx::Size viewport(800, 800); |
| 421 host_impl()->SetViewportSize(viewport); | 427 host_impl()->SetViewportSize(viewport); |
| 422 SetupDefaultTrees(layer_bounds); | 428 SetupDefaultTrees(layer_bounds); |
| 423 | 429 |
| 424 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); | 430 pending_layer()->tilings()->AddTiling( |
| 425 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); | 431 ScaleTranslate2d(1.5f, gfx::Vector2dF()), |
| 426 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); | 432 pending_layer()->raster_source()); |
| 427 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); | 433 active_layer()->tilings()->AddTiling(ScaleTranslate2d(1.5f, gfx::Vector2dF()), |
| 434 active_layer()->raster_source()); |
| 435 pending_layer()->tilings()->AddTiling( |
| 436 ScaleTranslate2d(1.7f, gfx::Vector2dF()), |
| 437 pending_layer()->raster_source()); |
| 438 active_layer()->tilings()->AddTiling(ScaleTranslate2d(1.7f, gfx::Vector2dF()), |
| 439 active_layer()->raster_source()); |
| 428 | 440 |
| 429 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, | 441 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, |
| 430 5.0, Occlusion(), true); | 442 5.0, Occlusion(), true); |
| 431 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 443 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 432 Occlusion(), true); | 444 Occlusion(), true); |
| 433 | 445 |
| 434 std::set<Tile*> all_expected_tiles; | 446 std::set<Tile*> all_expected_tiles; |
| 435 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { | 447 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { |
| 436 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); | 448 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); |
| 437 if (tiling->contents_scale() == 1.f) { | 449 if (tiling->contents_scale_key() == 1.f) { |
| 438 tiling->set_resolution(HIGH_RESOLUTION); | 450 tiling->set_resolution(HIGH_RESOLUTION); |
| 439 const auto& all_tiles = tiling->AllTilesForTesting(); | 451 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 440 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 452 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 441 } else { | 453 } else { |
| 442 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 454 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 443 } | 455 } |
| 444 } | 456 } |
| 445 | 457 |
| 446 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { | 458 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { |
| 447 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); | 459 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); |
| 448 if (tiling->contents_scale() == 1.5f) { | 460 if (tiling->contents_scale_key() == 1.5f) { |
| 449 tiling->set_resolution(HIGH_RESOLUTION); | 461 tiling->set_resolution(HIGH_RESOLUTION); |
| 450 const auto& all_tiles = tiling->AllTilesForTesting(); | 462 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 451 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 463 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 452 } else { | 464 } else { |
| 453 tiling->set_resolution(LOW_RESOLUTION); | 465 tiling->set_resolution(LOW_RESOLUTION); |
| 454 // Low res tilings with a high res pending twin have to be processed | 466 // Low res tilings with a high res pending twin have to be processed |
| 455 // because of possible activation tiles. | 467 // because of possible activation tiles. |
| 456 if (tiling->contents_scale() == 1.f) { | 468 if (tiling->contents_scale_key() == 1.f) { |
| 457 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 469 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 458 const auto& all_tiles = tiling->AllTilesForTesting(); | 470 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 459 for (auto* tile : all_tiles) | 471 for (auto* tile : all_tiles) |
| 460 EXPECT_TRUE(tile->required_for_activation()); | 472 EXPECT_TRUE(tile->required_for_activation()); |
| 461 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 473 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 462 } | 474 } |
| 463 } | 475 } |
| 464 } | 476 } |
| 465 | 477 |
| 466 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( | 478 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 | 916 |
| 905 bool last_tile_is_occluded = last_tile.is_occluded(); | 917 bool last_tile_is_occluded = last_tile.is_occluded(); |
| 906 if (!last_tile_is_occluded) { | 918 if (!last_tile_is_occluded) { |
| 907 TilePriority::PriorityBin tile_priority_bin = | 919 TilePriority::PriorityBin tile_priority_bin = |
| 908 prioritized_tile.priority().priority_bin; | 920 prioritized_tile.priority().priority_bin; |
| 909 TilePriority::PriorityBin last_tile_priority_bin = | 921 TilePriority::PriorityBin last_tile_priority_bin = |
| 910 last_tile.priority().priority_bin; | 922 last_tile.priority().priority_bin; |
| 911 | 923 |
| 912 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) || | 924 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) || |
| 913 prioritized_tile.tile()->required_for_activation() || | 925 prioritized_tile.tile()->required_for_activation() || |
| 914 (prioritized_tile.tile()->contents_scale() != | 926 (prioritized_tile.tile()->raster_transform() != |
| 915 last_tile.tile()->contents_scale())); | 927 last_tile.tile()->raster_transform())); |
| 916 } | 928 } |
| 917 } | 929 } |
| 918 last_tile = prioritized_tile; | 930 last_tile = prioritized_tile; |
| 919 queue->Pop(); | 931 queue->Pop(); |
| 920 } | 932 } |
| 921 size_t expected_occluded_count = pending_child_high_res_tiles.size(); | 933 size_t expected_occluded_count = pending_child_high_res_tiles.size(); |
| 922 EXPECT_EQ(expected_occluded_count, occluded_count); | 934 EXPECT_EQ(expected_occluded_count, occluded_count); |
| 923 } | 935 } |
| 924 | 936 |
| 925 TEST_F(TileManagerTilePriorityQueueTest, | 937 TEST_F(TileManagerTilePriorityQueueTest, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 | 1139 |
| 1128 std::unique_ptr<PictureLayerTilingSet> tiling_set = | 1140 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
| 1129 PictureLayerTilingSet::Create( | 1141 PictureLayerTilingSet::Create( |
| 1130 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1142 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
| 1131 settings.skewport_target_time_in_seconds, | 1143 settings.skewport_target_time_in_seconds, |
| 1132 settings.skewport_extrapolation_limit_in_screen_pixels, | 1144 settings.skewport_extrapolation_limit_in_screen_pixels, |
| 1133 settings.max_preraster_distance_in_screen_pixels); | 1145 settings.max_preraster_distance_in_screen_pixels); |
| 1134 | 1146 |
| 1135 scoped_refptr<FakeRasterSource> raster_source = | 1147 scoped_refptr<FakeRasterSource> raster_source = |
| 1136 FakeRasterSource::CreateFilled(layer_bounds); | 1148 FakeRasterSource::CreateFilled(layer_bounds); |
| 1137 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1149 PictureLayerTiling* tiling = |
| 1150 tiling_set->AddTiling(ScaleTranslate2d(), raster_source); |
| 1138 tiling->set_resolution(HIGH_RESOLUTION); | 1151 tiling->set_resolution(HIGH_RESOLUTION); |
| 1139 | 1152 |
| 1140 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); | 1153 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); |
| 1141 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); | 1154 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); |
| 1142 // Sanity check. | 1155 // Sanity check. |
| 1143 EXPECT_EQ(3364u, all_tiles.size()); | 1156 EXPECT_EQ(3364u, all_tiles.size()); |
| 1144 | 1157 |
| 1145 // The explanation of each iteration is as follows: | 1158 // The explanation of each iteration is as follows: |
| 1146 // 1. First iteration tests that we can get all of the tiles correctly. | 1159 // 1. First iteration tests that we can get all of the tiles correctly. |
| 1147 // 2. Second iteration ensures that we can get all of the tiles again (first | 1160 // 2. Second iteration ensures that we can get all of the tiles again (first |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 | 1251 |
| 1239 std::unique_ptr<PictureLayerTilingSet> tiling_set = | 1252 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
| 1240 PictureLayerTilingSet::Create( | 1253 PictureLayerTilingSet::Create( |
| 1241 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1254 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
| 1242 settings.skewport_target_time_in_seconds, | 1255 settings.skewport_target_time_in_seconds, |
| 1243 settings.skewport_extrapolation_limit_in_screen_pixels, | 1256 settings.skewport_extrapolation_limit_in_screen_pixels, |
| 1244 settings.max_preraster_distance_in_screen_pixels); | 1257 settings.max_preraster_distance_in_screen_pixels); |
| 1245 | 1258 |
| 1246 scoped_refptr<FakeRasterSource> raster_source = | 1259 scoped_refptr<FakeRasterSource> raster_source = |
| 1247 FakeRasterSource::CreateFilled(layer_bounds); | 1260 FakeRasterSource::CreateFilled(layer_bounds); |
| 1248 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1261 PictureLayerTiling* tiling = |
| 1262 tiling_set->AddTiling(ScaleTranslate2d(), raster_source); |
| 1249 tiling->set_resolution(HIGH_RESOLUTION); | 1263 tiling->set_resolution(HIGH_RESOLUTION); |
| 1250 | 1264 |
| 1251 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); | 1265 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); |
| 1252 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(), | 1266 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(), |
| 1253 true); | 1267 true); |
| 1254 | 1268 |
| 1255 const int soon_border_outset = 312; | 1269 const int soon_border_outset = 312; |
| 1256 gfx::Rect soon_rect = moved_viewport; | 1270 gfx::Rect soon_rect = moved_viewport; |
| 1257 soon_rect.Inset(-soon_border_outset, -soon_border_outset); | 1271 soon_rect.Inset(-soon_border_outset, -soon_border_outset); |
| 1258 | 1272 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 FakeRasterSource::CreateFilled(layer_bounds); | 1408 FakeRasterSource::CreateFilled(layer_bounds); |
| 1395 | 1409 |
| 1396 FakePictureLayerTilingClient pending_client; | 1410 FakePictureLayerTilingClient pending_client; |
| 1397 pending_client.SetTileSize(gfx::Size(64, 64)); | 1411 pending_client.SetTileSize(gfx::Size(64, 64)); |
| 1398 | 1412 |
| 1399 std::unique_ptr<PictureLayerTilingSet> tiling_set = | 1413 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
| 1400 PictureLayerTilingSet::Create(WhichTree::ACTIVE_TREE, &pending_client, | 1414 PictureLayerTilingSet::Create(WhichTree::ACTIVE_TREE, &pending_client, |
| 1401 1.0f, 1.0f, 1000, 1000.f); | 1415 1.0f, 1.0f, 1000, 1000.f); |
| 1402 pending_client.set_twin_tiling_set(tiling_set.get()); | 1416 pending_client.set_twin_tiling_set(tiling_set.get()); |
| 1403 | 1417 |
| 1404 auto* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1418 auto* tiling = tiling_set->AddTiling(ScaleTranslate2d(), raster_source); |
| 1405 | 1419 |
| 1406 tiling->set_resolution(HIGH_RESOLUTION); | 1420 tiling->set_resolution(HIGH_RESOLUTION); |
| 1407 tiling->CreateAllTilesForTesting(); | 1421 tiling->CreateAllTilesForTesting(); |
| 1408 | 1422 |
| 1409 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting | 1423 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting |
| 1410 // rectangle to test the advance phase with. The tile size is (64, 64), so | 1424 // rectangle to test the advance phase with. The tile size is (64, 64), so |
| 1411 // both rectangles intersect the tile content size, but only one should | 1425 // both rectangles intersect the tile content size, but only one should |
| 1412 // intersect the actual size. | 1426 // intersect the actual size. |
| 1413 gfx::Rect non_intersecting_rect(2, 2, 10, 10); | 1427 gfx::Rect non_intersecting_rect(2, 2, 10, 10); |
| 1414 gfx::Rect intersecting_rect(0, 0, 10, 10); | 1428 gfx::Rect intersecting_rect(0, 0, 10, 10); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1484 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
| 1471 | 1485 |
| 1472 FakePictureLayerTilingClient tiling_client; | 1486 FakePictureLayerTilingClient tiling_client; |
| 1473 tiling_client.SetTileSize(size); | 1487 tiling_client.SetTileSize(size); |
| 1474 | 1488 |
| 1475 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( | 1489 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( |
| 1476 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); | 1490 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); |
| 1477 layer_impl->set_is_drawn_render_surface_layer_list_member(true); | 1491 layer_impl->set_is_drawn_render_surface_layer_list_member(true); |
| 1478 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); | 1492 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); |
| 1479 | 1493 |
| 1480 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1494 PictureLayerTiling* tiling = |
| 1495 tiling_set->AddTiling(ScaleTranslate2d(), raster_source); |
| 1481 tiling->set_resolution(HIGH_RESOLUTION); | 1496 tiling->set_resolution(HIGH_RESOLUTION); |
| 1482 tiling->CreateAllTilesForTesting(); | 1497 tiling->CreateAllTilesForTesting(); |
| 1483 tiling->SetTilePriorityRectsForTesting( | 1498 tiling->SetTilePriorityRectsForTesting( |
| 1484 gfx::Rect(layer_bounds), // Visible rect. | 1499 gfx::Rect(layer_bounds), // Visible rect. |
| 1485 gfx::Rect(layer_bounds), // Skewport rect. | 1500 gfx::Rect(layer_bounds), // Skewport rect. |
| 1486 gfx::Rect(layer_bounds), // Soon rect. | 1501 gfx::Rect(layer_bounds), // Soon rect. |
| 1487 gfx::Rect(layer_bounds)); // Eventually rect. | 1502 gfx::Rect(layer_bounds)); // Eventually rect. |
| 1488 | 1503 |
| 1489 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 1504 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1490 | 1505 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1688 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
| 1674 | 1689 |
| 1675 FakePictureLayerTilingClient tiling_client; | 1690 FakePictureLayerTilingClient tiling_client; |
| 1676 tiling_client.SetTileSize(size); | 1691 tiling_client.SetTileSize(size); |
| 1677 | 1692 |
| 1678 std::unique_ptr<PictureLayerImpl> layer = PictureLayerImpl::Create( | 1693 std::unique_ptr<PictureLayerImpl> layer = PictureLayerImpl::Create( |
| 1679 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); | 1694 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); |
| 1680 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); | 1695 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); |
| 1681 layer->set_is_drawn_render_surface_layer_list_member(true); | 1696 layer->set_is_drawn_render_surface_layer_list_member(true); |
| 1682 | 1697 |
| 1683 auto* tiling = tiling_set->AddTiling(1.0f, raster); | 1698 auto* tiling = tiling_set->AddTiling(ScaleTranslate2d(), raster); |
| 1684 tiling->set_resolution(resolutions[i]); | 1699 tiling->set_resolution(resolutions[i]); |
| 1685 tiling->CreateAllTilesForTesting(); | 1700 tiling->CreateAllTilesForTesting(); |
| 1686 tiling->SetTilePriorityRectsForTesting( | 1701 tiling->SetTilePriorityRectsForTesting( |
| 1687 gfx::Rect(size), // Visible rect. | 1702 gfx::Rect(size), // Visible rect. |
| 1688 gfx::Rect(size), // Skewport rect. | 1703 gfx::Rect(size), // Skewport rect. |
| 1689 gfx::Rect(size), // Soon rect. | 1704 gfx::Rect(size), // Soon rect. |
| 1690 gfx::Rect(size)); // Eventually rect. | 1705 gfx::Rect(size)); // Eventually rect. |
| 1691 | 1706 |
| 1692 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster | 1707 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster |
| 1693 // LOW_RESOLUTION tiles, otherwise they are skipped. | 1708 // LOW_RESOLUTION tiles, otherwise they are skipped. |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1980 } | 1995 } |
| 1981 | 1996 |
| 1982 private: | 1997 private: |
| 1983 class FakeRasterBuffer : public RasterBuffer { | 1998 class FakeRasterBuffer : public RasterBuffer { |
| 1984 public: | 1999 public: |
| 1985 void Playback( | 2000 void Playback( |
| 1986 const RasterSource* raster_source, | 2001 const RasterSource* raster_source, |
| 1987 const gfx::Rect& raster_full_rect, | 2002 const gfx::Rect& raster_full_rect, |
| 1988 const gfx::Rect& raster_dirty_rect, | 2003 const gfx::Rect& raster_dirty_rect, |
| 1989 uint64_t new_content_id, | 2004 uint64_t new_content_id, |
| 1990 float scale, | 2005 const ScaleTranslate2d& transform, |
| 1991 const RasterSource::PlaybackSettings& playback_settings) override {} | 2006 const RasterSource::PlaybackSettings& playback_settings) override {} |
| 1992 }; | 2007 }; |
| 1993 }; | 2008 }; |
| 1994 | 2009 |
| 1995 class TileManagerReadyToDrawTest : public TileManagerTest { | 2010 class TileManagerReadyToDrawTest : public TileManagerTest { |
| 1996 public: | 2011 public: |
| 1997 ~TileManagerReadyToDrawTest() override { | 2012 ~TileManagerReadyToDrawTest() override { |
| 1998 // Ensure that the host impl doesn't outlive |raster_buffer_provider_|. | 2013 // Ensure that the host impl doesn't outlive |raster_buffer_provider_|. |
| 1999 TakeHostImpl(); | 2014 TakeHostImpl(); |
| 2000 } | 2015 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 | 2370 |
| 2356 recording_source->Rerecord(); | 2371 recording_source->Rerecord(); |
| 2357 scoped_refptr<RasterSource> raster_source = | 2372 scoped_refptr<RasterSource> raster_source = |
| 2358 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 2373 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
| 2359 | 2374 |
| 2360 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( | 2375 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( |
| 2361 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); | 2376 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); |
| 2362 layer_impl->set_is_drawn_render_surface_layer_list_member(true); | 2377 layer_impl->set_is_drawn_render_surface_layer_list_member(true); |
| 2363 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); | 2378 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); |
| 2364 | 2379 |
| 2365 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 2380 PictureLayerTiling* tiling = |
| 2381 tiling_set->AddTiling(ScaleTranslate2d(), raster_source); |
| 2366 tiling->set_resolution(HIGH_RESOLUTION); | 2382 tiling->set_resolution(HIGH_RESOLUTION); |
| 2367 tiling->CreateAllTilesForTesting(); | 2383 tiling->CreateAllTilesForTesting(); |
| 2368 tiling->SetTilePriorityRectsForTesting( | 2384 tiling->SetTilePriorityRectsForTesting( |
| 2369 gfx::Rect(layer_bounds), // Visible rect. | 2385 gfx::Rect(layer_bounds), // Visible rect. |
| 2370 gfx::Rect(layer_bounds), // Skewport rect. | 2386 gfx::Rect(layer_bounds), // Skewport rect. |
| 2371 gfx::Rect(layer_bounds), // Soon rect. | 2387 gfx::Rect(layer_bounds), // Soon rect. |
| 2372 gfx::Rect(layer_bounds)); // Eventually rect. | 2388 gfx::Rect(layer_bounds)); // Eventually rect. |
| 2373 | 2389 |
| 2374 // PrepareTiles and synchronously run all tasks added to the TaskGraph. Since | 2390 // PrepareTiles and synchronously run all tasks added to the TaskGraph. Since |
| 2375 // we are using a strict mock for the SkImageGenerator, if the decode runs as | 2391 // we are using a strict mock for the SkImageGenerator, if the decode runs as |
| 2376 // a part of raster tasks, the test should fail. | 2392 // a part of raster tasks, the test should fail. |
| 2377 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 2393 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 2378 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2394 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 2379 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); | 2395 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); |
| 2380 base::RunLoop().RunUntilIdle(); | 2396 base::RunLoop().RunUntilIdle(); |
| 2381 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); | 2397 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 2382 } | 2398 } |
| 2383 | 2399 |
| 2384 } // namespace | 2400 } // namespace |
| 2385 } // namespace cc | 2401 } // namespace cc |
| OLD | NEW |