| 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 "base/thread_task_runner_handle.h" | 5 #include "base/thread_task_runner_handle.h" |
| 6 #include "cc/resources/eviction_tile_priority_queue.h" | 6 #include "cc/resources/eviction_tile_priority_queue.h" |
| 7 #include "cc/resources/raster_tile_priority_queue.h" | 7 #include "cc/resources/raster_tile_priority_queue.h" |
| 8 #include "cc/resources/resource_pool.h" | 8 #include "cc/resources/resource_pool.h" |
| 9 #include "cc/resources/tile.h" | 9 #include "cc/resources/tile.h" |
| 10 #include "cc/resources/tile_priority.h" | 10 #include "cc/resources/tile_priority.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 EXPECT_EQ(16u, tile_count); | 176 EXPECT_EQ(16u, tile_count); |
| 177 | 177 |
| 178 // Sanity check, all tiles should be visible. | 178 // Sanity check, all tiles should be visible. |
| 179 std::set<Tile*> smoothness_tiles; | 179 std::set<Tile*> smoothness_tiles; |
| 180 queue = host_impl_.BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, | 180 queue = host_impl_.BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, |
| 181 RasterTilePriorityQueue::Type::ALL); | 181 RasterTilePriorityQueue::Type::ALL); |
| 182 bool had_low_res = false; | 182 bool had_low_res = false; |
| 183 while (!queue->IsEmpty()) { | 183 while (!queue->IsEmpty()) { |
| 184 Tile* tile = queue->Top(); | 184 Tile* tile = queue->Top(); |
| 185 EXPECT_TRUE(tile); | 185 EXPECT_TRUE(tile); |
| 186 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); | 186 EXPECT_EQ(TilePriority::NOW, tile->priority().priority_bin); |
| 187 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); | 187 if (tile->priority().resolution == LOW_RESOLUTION) |
| 188 if (tile->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) | |
| 189 had_low_res = true; | 188 had_low_res = true; |
| 190 else | 189 else |
| 191 smoothness_tiles.insert(tile); | 190 smoothness_tiles.insert(tile); |
| 192 queue->Pop(); | 191 queue->Pop(); |
| 193 } | 192 } |
| 194 EXPECT_EQ(all_tiles, smoothness_tiles); | 193 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 195 EXPECT_TRUE(had_low_res); | 194 EXPECT_TRUE(had_low_res); |
| 196 | 195 |
| 197 // Check that everything is required for activation. | 196 // Check that everything is required for activation. |
| 198 queue = host_impl_.BuildRasterQueue( | 197 queue = host_impl_.BuildRasterQueue( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 RasterTilePriorityQueue::Type::ALL); | 276 RasterTilePriorityQueue::Type::ALL); |
| 278 std::set<Tile*> expected_required_for_draw_tiles; | 277 std::set<Tile*> expected_required_for_draw_tiles; |
| 279 std::set<Tile*> expected_required_for_activation_tiles; | 278 std::set<Tile*> expected_required_for_activation_tiles; |
| 280 while (!queue->IsEmpty()) { | 279 while (!queue->IsEmpty()) { |
| 281 Tile* tile = queue->Top(); | 280 Tile* tile = queue->Top(); |
| 282 EXPECT_TRUE(tile); | 281 EXPECT_TRUE(tile); |
| 283 | 282 |
| 284 if (!last_tile) | 283 if (!last_tile) |
| 285 last_tile = tile; | 284 last_tile = tile; |
| 286 | 285 |
| 287 EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, | 286 EXPECT_LE(last_tile->priority().priority_bin, |
| 288 tile->priority(ACTIVE_TREE).priority_bin); | 287 tile->priority().priority_bin); |
| 289 bool skip_updating_last_tile = false; | 288 bool skip_updating_last_tile = false; |
| 290 if (last_tile->priority(ACTIVE_TREE).priority_bin == | 289 if (last_tile->priority().priority_bin == tile->priority().priority_bin) { |
| 291 tile->priority(ACTIVE_TREE).priority_bin) { | 290 correct_order_tiles += last_tile->priority().distance_to_visible <= |
| 292 correct_order_tiles += | 291 tile->priority().distance_to_visible; |
| 293 last_tile->priority(ACTIVE_TREE).distance_to_visible <= | 292 } else if (tile->priority().priority_bin == TilePriority::NOW) { |
| 294 tile->priority(ACTIVE_TREE).distance_to_visible; | |
| 295 } else if (tile->priority(ACTIVE_TREE).priority_bin == | |
| 296 TilePriority::EVENTUALLY && | |
| 297 tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW) { | |
| 298 // Since we'd return pending tree now tiles before the eventually tiles on | 293 // Since we'd return pending tree now tiles before the eventually tiles on |
| 299 // the active tree, update the value. | 294 // the active tree, update the value. |
| 300 ++correct_order_tiles; | 295 ++correct_order_tiles; |
| 301 skip_updating_last_tile = true; | 296 skip_updating_last_tile = true; |
| 302 } | 297 } |
| 303 | 298 |
| 304 if (tile->priority(ACTIVE_TREE).priority_bin == TilePriority::NOW && | 299 if (tile->priority().priority_bin == TilePriority::NOW && |
| 305 last_tile->priority(ACTIVE_TREE).resolution != | 300 last_tile->priority().resolution != tile->priority().resolution) { |
| 306 tile->priority(ACTIVE_TREE).resolution) { | |
| 307 // Low resolution should come first. | 301 // Low resolution should come first. |
| 308 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); | 302 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority().resolution); |
| 309 } | 303 } |
| 310 | 304 |
| 311 if (!skip_updating_last_tile) | 305 if (!skip_updating_last_tile) |
| 312 last_tile = tile; | 306 last_tile = tile; |
| 313 ++tile_count; | 307 ++tile_count; |
| 314 smoothness_tiles.insert(tile); | 308 smoothness_tiles.insert(tile); |
| 315 if (tile->required_for_draw()) | 309 if (tile->required_for_draw()) |
| 316 expected_required_for_draw_tiles.insert(tile); | 310 expected_required_for_draw_tiles.insert(tile); |
| 317 if (tile->required_for_activation()) | 311 if (tile->required_for_activation()) |
| 318 expected_required_for_activation_tiles.insert(tile); | 312 expected_required_for_activation_tiles.insert(tile); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 queue = host_impl_.BuildRasterQueue(NEW_CONTENT_TAKES_PRIORITY, | 355 queue = host_impl_.BuildRasterQueue(NEW_CONTENT_TAKES_PRIORITY, |
| 362 RasterTilePriorityQueue::Type::ALL); | 356 RasterTilePriorityQueue::Type::ALL); |
| 363 tile_count = 0; | 357 tile_count = 0; |
| 364 while (!queue->IsEmpty()) { | 358 while (!queue->IsEmpty()) { |
| 365 Tile* tile = queue->Top(); | 359 Tile* tile = queue->Top(); |
| 366 EXPECT_TRUE(tile); | 360 EXPECT_TRUE(tile); |
| 367 | 361 |
| 368 if (!last_tile) | 362 if (!last_tile) |
| 369 last_tile = tile; | 363 last_tile = tile; |
| 370 | 364 |
| 371 EXPECT_LE(last_tile->priority(PENDING_TREE).priority_bin, | 365 EXPECT_LE(last_tile->priority().priority_bin, |
| 372 tile->priority(PENDING_TREE).priority_bin); | 366 tile->priority().priority_bin); |
| 373 if (last_tile->priority(PENDING_TREE).priority_bin == | 367 if (last_tile->priority().priority_bin == tile->priority().priority_bin) { |
| 374 tile->priority(PENDING_TREE).priority_bin) { | 368 increasing_distance_tiles += last_tile->priority().distance_to_visible <= |
| 375 increasing_distance_tiles += | 369 tile->priority().distance_to_visible; |
| 376 last_tile->priority(PENDING_TREE).distance_to_visible <= | |
| 377 tile->priority(PENDING_TREE).distance_to_visible; | |
| 378 } | 370 } |
| 379 | 371 |
| 380 if (tile->priority(PENDING_TREE).priority_bin == TilePriority::NOW && | 372 if (tile->priority().priority_bin == TilePriority::NOW && |
| 381 last_tile->priority(PENDING_TREE).resolution != | 373 last_tile->priority().resolution != tile->priority().resolution) { |
| 382 tile->priority(PENDING_TREE).resolution) { | |
| 383 // High resolution should come first. | 374 // High resolution should come first. |
| 384 EXPECT_EQ(HIGH_RESOLUTION, last_tile->priority(PENDING_TREE).resolution); | 375 EXPECT_EQ(HIGH_RESOLUTION, last_tile->priority().resolution); |
| 385 } | 376 } |
| 386 | 377 |
| 387 last_tile = tile; | 378 last_tile = tile; |
| 388 new_content_tiles.insert(tile); | 379 new_content_tiles.insert(tile); |
| 389 ++tile_count; | 380 ++tile_count; |
| 390 queue->Pop(); | 381 queue->Pop(); |
| 391 } | 382 } |
| 392 | 383 |
| 393 EXPECT_EQ(tile_count, new_content_tiles.size()); | 384 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 394 EXPECT_EQ(high_res_tiles, new_content_tiles); | 385 EXPECT_EQ(high_res_tiles, new_content_tiles); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 419 |
| 429 TEST_F(TileManagerTilePriorityQueueTest, | 420 TEST_F(TileManagerTilePriorityQueueTest, |
| 430 RasterTilePriorityQueueHighNonIdealTilings) { | 421 RasterTilePriorityQueueHighNonIdealTilings) { |
| 431 const gfx::Size layer_bounds(1000, 1000); | 422 const gfx::Size layer_bounds(1000, 1000); |
| 432 const gfx::Size viewport(800, 800); | 423 const gfx::Size viewport(800, 800); |
| 433 host_impl_.SetViewportSize(viewport); | 424 host_impl_.SetViewportSize(viewport); |
| 434 SetupDefaultTrees(layer_bounds); | 425 SetupDefaultTrees(layer_bounds); |
| 435 | 426 |
| 436 pending_layer_->tilings()->AddTiling(1.5f, pending_layer_->raster_source()); | 427 pending_layer_->tilings()->AddTiling(1.5f, pending_layer_->raster_source()); |
| 437 active_layer_->tilings()->AddTiling(1.5f, active_layer_->raster_source()); | 428 active_layer_->tilings()->AddTiling(1.5f, active_layer_->raster_source()); |
| 429 pending_layer_->tilings()->AddTiling(1.7f, pending_layer_->raster_source()); |
| 430 active_layer_->tilings()->AddTiling(1.7f, active_layer_->raster_source()); |
| 438 | 431 |
| 439 pending_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 432 pending_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 440 Occlusion(), true); | 433 Occlusion(), true); |
| 441 active_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 434 active_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 442 Occlusion(), true); | 435 Occlusion(), true); |
| 443 | 436 |
| 444 std::set<Tile*> all_expected_tiles; | 437 std::set<Tile*> all_expected_tiles; |
| 445 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 438 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
| 446 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 439 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
| 447 tiling->CreateAllTilesForTesting(); | |
| 448 if (tiling->contents_scale() == 1.f) { | 440 if (tiling->contents_scale() == 1.f) { |
| 449 tiling->set_resolution(HIGH_RESOLUTION); | 441 tiling->set_resolution(HIGH_RESOLUTION); |
| 450 const auto& all_tiles = tiling->AllTilesForTesting(); | 442 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 451 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 443 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 452 } else { | 444 } else { |
| 453 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 445 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 454 } | 446 } |
| 455 } | 447 } |
| 456 | 448 |
| 457 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { | 449 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { |
| 458 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); | 450 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); |
| 459 tiling->CreateAllTilesForTesting(); | |
| 460 if (tiling->contents_scale() == 1.5f) { | 451 if (tiling->contents_scale() == 1.5f) { |
| 461 tiling->set_resolution(HIGH_RESOLUTION); | 452 tiling->set_resolution(HIGH_RESOLUTION); |
| 462 const auto& all_tiles = tiling->AllTilesForTesting(); | 453 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 463 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 454 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 464 } else { | 455 } else { |
| 465 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 456 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 457 // Non ideal tilings with a high res pending twin have to be processed |
| 458 // because of possible activation tiles. |
| 459 if (tiling->contents_scale() == 1.f) { |
| 460 tiling->UpdateAllTilePrioritiesForTesting(); |
| 461 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 462 for (auto* tile : all_tiles) |
| 463 EXPECT_TRUE(tile->required_for_activation()); |
| 464 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 465 } |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 469 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
| 470 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 470 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
| 471 EXPECT_FALSE(queue->IsEmpty()); | 471 EXPECT_FALSE(queue->IsEmpty()); |
| 472 | 472 |
| 473 size_t tile_count = 0; | 473 size_t tile_count = 0; |
| 474 std::set<Tile*> all_actual_tiles; | 474 std::set<Tile*> all_actual_tiles; |
| 475 while (!queue->IsEmpty()) { | 475 while (!queue->IsEmpty()) { |
| 476 EXPECT_TRUE(queue->Top()); | 476 EXPECT_TRUE(queue->Top()); |
| 477 all_actual_tiles.insert(queue->Top()); | 477 all_actual_tiles.insert(queue->Top()); |
| 478 ++tile_count; | 478 ++tile_count; |
| 479 queue->Pop(); | 479 queue->Pop(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 EXPECT_EQ(tile_count, all_actual_tiles.size()); | 482 EXPECT_EQ(tile_count, all_actual_tiles.size()); |
| 483 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); | 483 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); |
| 484 EXPECT_EQ(all_expected_tiles, all_actual_tiles); | 484 EXPECT_EQ(all_expected_tiles, all_actual_tiles); |
| 485 } | 485 } |
| 486 | 486 |
| 487 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { | 487 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { |
| 488 const gfx::Size layer_bounds(1000, 1000); | 488 const gfx::Size layer_bounds(1000, 1000); |
| 489 host_impl_.SetViewportSize(gfx::Size(500, 500)); | 489 host_impl_.SetViewportSize(gfx::Size(500, 500)); |
| 490 SetupDefaultTrees(layer_bounds); | 490 SetupDefaultTrees(layer_bounds); |
| 491 | 491 |
| 492 // Use a tile's content rect as an invalidation. We should inset it a bit to | 492 // Use a tile's content rect as an invalidation. We should inset it a bit to |
| 493 // ensure that border math doesn't invalidate neighbouring tiles. | 493 // ensure that border math doesn't invalidate neighbouring tiles. |
| 494 gfx::Rect invalidation = | 494 gfx::Rect invalidation = |
| 495 pending_layer_->HighResTiling()->TileAt(1, 0)->content_rect(); | 495 active_layer_->HighResTiling()->TileAt(1, 0)->content_rect(); |
| 496 invalidation.Inset(2, 2); | 496 invalidation.Inset(2, 2); |
| 497 | 497 |
| 498 pending_layer_->set_invalidation(invalidation); | 498 pending_layer_->set_invalidation(invalidation); |
| 499 pending_layer_->HighResTiling()->Invalidate(invalidation); | 499 pending_layer_->HighResTiling()->Invalidate(invalidation); |
| 500 pending_layer_->HighResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 500 pending_layer_->LowResTiling()->Invalidate(invalidation); | 501 pending_layer_->LowResTiling()->Invalidate(invalidation); |
| 502 pending_layer_->LowResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 501 | 503 |
| 502 // Sanity checks: Tile at 0, 0 should be the same on both trees, tile at 1, 0 | 504 // Sanity checks: Tile at 0, 0 not exist on the pending tree (it's not |
| 503 // should be different. | 505 // invalidated). Tile 1, 0 should exist on both. |
| 504 EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(0, 0)); | 506 EXPECT_FALSE(pending_layer_->HighResTiling()->TileAt(0, 0)); |
| 505 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(0, 0)); | 507 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(0, 0)); |
| 506 EXPECT_EQ(pending_layer_->HighResTiling()->TileAt(0, 0), | |
| 507 active_layer_->HighResTiling()->TileAt(0, 0)); | |
| 508 EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(1, 0)); | 508 EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(1, 0)); |
| 509 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(1, 0)); | 509 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(1, 0)); |
| 510 EXPECT_NE(pending_layer_->HighResTiling()->TileAt(1, 0), | 510 EXPECT_NE(pending_layer_->HighResTiling()->TileAt(1, 0), |
| 511 active_layer_->HighResTiling()->TileAt(1, 0)); | 511 active_layer_->HighResTiling()->TileAt(1, 0)); |
| 512 | 512 |
| 513 std::set<Tile*> expected_now_tiles; | 513 std::set<Tile*> expected_now_tiles; |
| 514 std::set<Tile*> expected_required_for_draw_tiles; | 514 std::set<Tile*> expected_required_for_draw_tiles; |
| 515 std::set<Tile*> expected_required_for_activation_tiles; | 515 std::set<Tile*> expected_required_for_activation_tiles; |
| 516 for (int i = 0; i <= 1; ++i) { | 516 for (int i = 0; i <= 1; ++i) { |
| 517 for (int j = 0; j <= 1; ++j) { | 517 for (int j = 0; j <= 1; ++j) { |
| 518 expected_now_tiles.insert(pending_layer_->HighResTiling()->TileAt(i, j)); | 518 bool have_pending_tile = false; |
| 519 expected_now_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); | 519 if (pending_layer_->HighResTiling()->TileAt(i, j)) { |
| 520 | 520 expected_now_tiles.insert( |
| 521 expected_required_for_activation_tiles.insert( | 521 pending_layer_->HighResTiling()->TileAt(i, j)); |
| 522 pending_layer_->HighResTiling()->TileAt(i, j)); | 522 expected_required_for_activation_tiles.insert( |
| 523 expected_required_for_draw_tiles.insert( | 523 pending_layer_->HighResTiling()->TileAt(i, j)); |
| 524 active_layer_->HighResTiling()->TileAt(i, j)); | 524 have_pending_tile = true; |
| 525 } |
| 526 Tile* active_tile = active_layer_->HighResTiling()->TileAt(i, j); |
| 527 EXPECT_TRUE(active_tile); |
| 528 expected_now_tiles.insert(active_tile); |
| 529 expected_required_for_draw_tiles.insert(active_tile); |
| 530 if (!have_pending_tile) |
| 531 expected_required_for_activation_tiles.insert(active_tile); |
| 525 } | 532 } |
| 526 } | 533 } |
| 527 // Expect 3 shared tiles and 1 unshared tile in total. | 534 // Expect 3 shared tiles and 1 unshared tile in total. |
| 528 EXPECT_EQ(5u, expected_now_tiles.size()); | 535 EXPECT_EQ(5u, expected_now_tiles.size()); |
| 529 // Expect 4 tiles for each draw and activation, but not all the same. | 536 // Expect 4 tiles for each draw and activation, but not all the same. |
| 530 EXPECT_EQ(4u, expected_required_for_activation_tiles.size()); | 537 EXPECT_EQ(4u, expected_required_for_activation_tiles.size()); |
| 531 EXPECT_EQ(4u, expected_required_for_draw_tiles.size()); | 538 EXPECT_EQ(4u, expected_required_for_draw_tiles.size()); |
| 532 EXPECT_NE(expected_required_for_draw_tiles, | 539 EXPECT_NE(expected_required_for_draw_tiles, |
| 533 expected_required_for_activation_tiles); | 540 expected_required_for_activation_tiles); |
| 534 | 541 |
| 535 std::set<Tile*> expected_all_tiles; | 542 std::set<Tile*> expected_all_tiles; |
| 536 for (int i = 0; i <= 3; ++i) { | 543 for (int i = 0; i <= 3; ++i) { |
| 537 for (int j = 0; j <= 3; ++j) { | 544 for (int j = 0; j <= 3; ++j) { |
| 538 expected_all_tiles.insert(pending_layer_->HighResTiling()->TileAt(i, j)); | 545 if (pending_layer_->HighResTiling()->TileAt(i, j)) |
| 546 expected_all_tiles.insert( |
| 547 pending_layer_->HighResTiling()->TileAt(i, j)); |
| 548 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(i, j)); |
| 539 expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); | 549 expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); |
| 540 } | 550 } |
| 541 } | 551 } |
| 542 // Expect 15 shared tiles and 1 unshared tile. | 552 // Expect 15 shared tiles and 1 unshared tile. |
| 543 EXPECT_EQ(17u, expected_all_tiles.size()); | 553 EXPECT_EQ(17u, expected_all_tiles.size()); |
| 544 | 554 |
| 545 // The actual test will now build different queues and verify that the queues | 555 // The actual test will now build different queues and verify that the queues |
| 546 // return the same information as computed manually above. | 556 // return the same information as computed manually above. |
| 547 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 557 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
| 548 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 558 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 549 std::set<Tile*> actual_now_tiles; | 559 std::set<Tile*> actual_now_tiles; |
| 550 std::set<Tile*> actual_all_tiles; | 560 std::set<Tile*> actual_all_tiles; |
| 551 while (!queue->IsEmpty()) { | 561 while (!queue->IsEmpty()) { |
| 552 Tile* tile = queue->Top(); | 562 Tile* tile = queue->Top(); |
| 553 queue->Pop(); | 563 queue->Pop(); |
| 554 if (tile->combined_priority().priority_bin == TilePriority::NOW) | 564 if (tile->priority().priority_bin == TilePriority::NOW) |
| 555 actual_now_tiles.insert(tile); | 565 actual_now_tiles.insert(tile); |
| 556 actual_all_tiles.insert(tile); | 566 actual_all_tiles.insert(tile); |
| 557 } | 567 } |
| 558 EXPECT_EQ(expected_now_tiles, actual_now_tiles); | 568 EXPECT_EQ(expected_now_tiles, actual_now_tiles); |
| 559 EXPECT_EQ(expected_all_tiles, actual_all_tiles); | 569 EXPECT_EQ(expected_all_tiles, actual_all_tiles); |
| 560 | 570 |
| 561 queue = host_impl_.BuildRasterQueue( | 571 queue = host_impl_.BuildRasterQueue( |
| 562 SAME_PRIORITY_FOR_BOTH_TREES, | 572 SAME_PRIORITY_FOR_BOTH_TREES, |
| 563 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 573 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 564 std::set<Tile*> actual_required_for_draw_tiles; | 574 std::set<Tile*> actual_required_for_draw_tiles; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 host_impl_.SetRequiresHighResToDraw(); | 623 host_impl_.SetRequiresHighResToDraw(); |
| 614 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 624 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
| 615 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 625 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
| 616 EXPECT_FALSE(queue->IsEmpty()); | 626 EXPECT_FALSE(queue->IsEmpty()); |
| 617 | 627 |
| 618 // Get all the tiles that are NOW or SOON and make sure they are ready to | 628 // Get all the tiles that are NOW or SOON and make sure they are ready to |
| 619 // draw. | 629 // draw. |
| 620 std::vector<Tile*> all_tiles; | 630 std::vector<Tile*> all_tiles; |
| 621 while (!queue->IsEmpty()) { | 631 while (!queue->IsEmpty()) { |
| 622 Tile* tile = queue->Top(); | 632 Tile* tile = queue->Top(); |
| 623 if (tile->combined_priority().priority_bin >= TilePriority::EVENTUALLY) | 633 if (tile->priority().priority_bin >= TilePriority::EVENTUALLY) |
| 624 break; | 634 break; |
| 625 | 635 |
| 626 all_tiles.push_back(tile); | 636 all_tiles.push_back(tile); |
| 627 queue->Pop(); | 637 queue->Pop(); |
| 628 } | 638 } |
| 629 | 639 |
| 630 tile_manager()->InitializeTilesWithResourcesForTesting( | 640 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 631 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 641 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 632 | 642 |
| 633 // Ensure we can activate. | 643 // Ensure we can activate. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 662 | 672 |
| 663 scoped_ptr<EvictionTilePriorityQueue> queue( | 673 scoped_ptr<EvictionTilePriorityQueue> queue( |
| 664 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); | 674 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); |
| 665 EXPECT_FALSE(queue->IsEmpty()); | 675 EXPECT_FALSE(queue->IsEmpty()); |
| 666 | 676 |
| 667 // Sanity check, all tiles should be visible. | 677 // Sanity check, all tiles should be visible. |
| 668 std::set<Tile*> smoothness_tiles; | 678 std::set<Tile*> smoothness_tiles; |
| 669 while (!queue->IsEmpty()) { | 679 while (!queue->IsEmpty()) { |
| 670 Tile* tile = queue->Top(); | 680 Tile* tile = queue->Top(); |
| 671 EXPECT_TRUE(tile); | 681 EXPECT_TRUE(tile); |
| 672 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); | 682 EXPECT_EQ(TilePriority::NOW, tile->priority().priority_bin); |
| 673 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); | |
| 674 EXPECT_TRUE(tile->HasResource()); | 683 EXPECT_TRUE(tile->HasResource()); |
| 675 smoothness_tiles.insert(tile); | 684 smoothness_tiles.insert(tile); |
| 676 queue->Pop(); | 685 queue->Pop(); |
| 677 } | 686 } |
| 678 EXPECT_EQ(all_tiles, smoothness_tiles); | 687 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 679 | 688 |
| 680 tile_manager()->ReleaseTileResourcesForTesting( | 689 tile_manager()->ReleaseTileResourcesForTesting( |
| 681 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 690 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 682 | 691 |
| 683 Region invalidation(gfx::Rect(0, 0, 500, 500)); | 692 Region invalidation(gfx::Rect(0, 0, 500, 500)); |
| 684 | 693 |
| 685 // Invalidate the pending tree. | 694 // Invalidate the pending tree. |
| 686 pending_layer_->set_invalidation(invalidation); | 695 pending_layer_->set_invalidation(invalidation); |
| 687 pending_layer_->HighResTiling()->Invalidate(invalidation); | 696 pending_layer_->HighResTiling()->Invalidate(invalidation); |
| 697 pending_layer_->HighResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 688 pending_layer_->LowResTiling()->Invalidate(invalidation); | 698 pending_layer_->LowResTiling()->Invalidate(invalidation); |
| 699 pending_layer_->LowResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 689 | 700 |
| 690 active_layer_->ResetAllTilesPriorities(); | 701 active_layer_->ResetAllTilesPriorities(); |
| 691 pending_layer_->ResetAllTilesPriorities(); | 702 pending_layer_->ResetAllTilesPriorities(); |
| 692 | 703 |
| 693 // Renew all of the tile priorities. | 704 // Renew all of the tile priorities. |
| 694 gfx::Rect viewport(50, 50, 100, 100); | 705 gfx::Rect viewport(50, 50, 100, 100); |
| 695 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 706 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 696 Occlusion()); | 707 Occlusion()); |
| 697 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 708 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 698 Occlusion()); | 709 Occlusion()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 int distance_increasing = 0; | 745 int distance_increasing = 0; |
| 735 int distance_decreasing = 0; | 746 int distance_decreasing = 0; |
| 736 while (!queue->IsEmpty()) { | 747 while (!queue->IsEmpty()) { |
| 737 Tile* tile = queue->Top(); | 748 Tile* tile = queue->Top(); |
| 738 EXPECT_TRUE(tile); | 749 EXPECT_TRUE(tile); |
| 739 EXPECT_TRUE(tile->HasResource()); | 750 EXPECT_TRUE(tile->HasResource()); |
| 740 | 751 |
| 741 if (!last_tile) | 752 if (!last_tile) |
| 742 last_tile = tile; | 753 last_tile = tile; |
| 743 | 754 |
| 744 const TilePriority& last_priority = last_tile->combined_priority(); | 755 const TilePriority& last_priority = last_tile->priority(); |
| 745 const TilePriority& priority = tile->combined_priority(); | 756 const TilePriority& priority = tile->priority(); |
| 746 | 757 |
| 747 EXPECT_GE(last_priority.priority_bin, priority.priority_bin); | 758 EXPECT_GE(last_priority.priority_bin, priority.priority_bin); |
| 748 if (last_priority.priority_bin == priority.priority_bin) { | 759 if (last_priority.priority_bin == priority.priority_bin) { |
| 749 EXPECT_LE(last_tile->required_for_activation(), | 760 EXPECT_LE(last_tile->required_for_activation(), |
| 750 tile->required_for_activation()); | 761 tile->required_for_activation()); |
| 751 if (last_tile->required_for_activation() == | 762 if (last_tile->required_for_activation() == |
| 752 tile->required_for_activation()) { | 763 tile->required_for_activation()) { |
| 753 if (last_priority.distance_to_visible >= priority.distance_to_visible) | 764 if (last_priority.distance_to_visible >= priority.distance_to_visible) |
| 754 ++distance_decreasing; | 765 ++distance_decreasing; |
| 755 else | 766 else |
| (...skipping 19 matching lines...) Expand all Loading... |
| 775 queue = host_impl_.BuildEvictionQueue(NEW_CONTENT_TAKES_PRIORITY); | 786 queue = host_impl_.BuildEvictionQueue(NEW_CONTENT_TAKES_PRIORITY); |
| 776 distance_decreasing = 0; | 787 distance_decreasing = 0; |
| 777 distance_increasing = 0; | 788 distance_increasing = 0; |
| 778 while (!queue->IsEmpty()) { | 789 while (!queue->IsEmpty()) { |
| 779 Tile* tile = queue->Top(); | 790 Tile* tile = queue->Top(); |
| 780 EXPECT_TRUE(tile); | 791 EXPECT_TRUE(tile); |
| 781 | 792 |
| 782 if (!last_tile) | 793 if (!last_tile) |
| 783 last_tile = tile; | 794 last_tile = tile; |
| 784 | 795 |
| 785 const TilePriority& last_priority = last_tile->combined_priority(); | 796 const TilePriority& last_priority = last_tile->priority(); |
| 786 const TilePriority& priority = tile->combined_priority(); | 797 const TilePriority& priority = tile->priority(); |
| 787 | 798 |
| 788 EXPECT_GE(last_priority.priority_bin, priority.priority_bin); | 799 EXPECT_GE(last_priority.priority_bin, priority.priority_bin); |
| 789 if (last_priority.priority_bin == priority.priority_bin) { | 800 if (last_priority.priority_bin == priority.priority_bin) { |
| 790 EXPECT_LE(last_tile->required_for_activation(), | 801 EXPECT_LE(last_tile->required_for_activation(), |
| 791 tile->required_for_activation()); | 802 tile->required_for_activation()); |
| 792 if (last_tile->required_for_activation() == | 803 if (last_tile->required_for_activation() == |
| 793 tile->required_for_activation()) { | 804 tile->required_for_activation()) { |
| 794 if (last_priority.distance_to_visible >= priority.distance_to_visible) | 805 if (last_priority.distance_to_visible >= priority.distance_to_visible) |
| 795 ++distance_decreasing; | 806 ++distance_decreasing; |
| 796 else | 807 else |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 926 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
| 916 size_t occluded_count = 0u; | 927 size_t occluded_count = 0u; |
| 917 Tile* last_tile = NULL; | 928 Tile* last_tile = NULL; |
| 918 scoped_ptr<EvictionTilePriorityQueue> queue( | 929 scoped_ptr<EvictionTilePriorityQueue> queue( |
| 919 host_impl_.BuildEvictionQueue(tree_priority)); | 930 host_impl_.BuildEvictionQueue(tree_priority)); |
| 920 while (!queue->IsEmpty()) { | 931 while (!queue->IsEmpty()) { |
| 921 Tile* tile = queue->Top(); | 932 Tile* tile = queue->Top(); |
| 922 if (!last_tile) | 933 if (!last_tile) |
| 923 last_tile = tile; | 934 last_tile = tile; |
| 924 | 935 |
| 925 bool tile_is_occluded = tile->is_occluded_combined(); | 936 bool tile_is_occluded = tile->is_occluded(); |
| 926 | 937 |
| 927 // The only way we will encounter an occluded tile after an unoccluded | 938 // The only way we will encounter an occluded tile after an unoccluded |
| 928 // tile is if the priorty bin decreased, the tile is required for | 939 // tile is if the priorty bin decreased, the tile is required for |
| 929 // activation, or the scale changed. | 940 // activation, or the scale changed. |
| 930 if (tile_is_occluded) { | 941 if (tile_is_occluded) { |
| 931 occluded_count++; | 942 occluded_count++; |
| 932 | 943 |
| 933 bool last_tile_is_occluded = last_tile->is_occluded_combined(); | 944 bool last_tile_is_occluded = last_tile->is_occluded(); |
| 934 if (!last_tile_is_occluded) { | 945 if (!last_tile_is_occluded) { |
| 935 TilePriority::PriorityBin tile_priority_bin = | 946 TilePriority::PriorityBin tile_priority_bin = |
| 936 tile->priority_for_tree_priority(tree_priority).priority_bin; | 947 tile->priority().priority_bin; |
| 937 TilePriority::PriorityBin last_tile_priority_bin = | 948 TilePriority::PriorityBin last_tile_priority_bin = |
| 938 last_tile->priority_for_tree_priority(tree_priority).priority_bin; | 949 last_tile->priority().priority_bin; |
| 939 | 950 |
| 940 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) || | 951 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) || |
| 941 tile->required_for_activation() || | 952 tile->required_for_activation() || |
| 942 (tile->contents_scale() != last_tile->contents_scale())); | 953 (tile->contents_scale() != last_tile->contents_scale())); |
| 943 } | 954 } |
| 944 } | 955 } |
| 945 last_tile = tile; | 956 last_tile = tile; |
| 946 queue->Pop(); | 957 queue->Pop(); |
| 947 } | 958 } |
| 948 size_t expected_occluded_count = | 959 size_t expected_occluded_count = |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // Verify that eviction queue returns tiles also from layers without valid | 1049 // Verify that eviction queue returns tiles also from layers without valid |
| 1039 // tile priorities and that the tile priority bin of those tiles is (at most) | 1050 // tile priorities and that the tile priority bin of those tiles is (at most) |
| 1040 // EVENTUALLY. | 1051 // EVENTUALLY. |
| 1041 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 1052 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
| 1042 std::set<Tile*> new_content_tiles; | 1053 std::set<Tile*> new_content_tiles; |
| 1043 size_t tile_count = 0; | 1054 size_t tile_count = 0; |
| 1044 scoped_ptr<EvictionTilePriorityQueue> queue( | 1055 scoped_ptr<EvictionTilePriorityQueue> queue( |
| 1045 host_impl_.BuildEvictionQueue(tree_priority)); | 1056 host_impl_.BuildEvictionQueue(tree_priority)); |
| 1046 while (!queue->IsEmpty()) { | 1057 while (!queue->IsEmpty()) { |
| 1047 Tile* tile = queue->Top(); | 1058 Tile* tile = queue->Top(); |
| 1048 const TilePriority& pending_priority = tile->priority(PENDING_TREE); | 1059 const TilePriority& pending_priority = tile->priority(); |
| 1049 EXPECT_NE(std::numeric_limits<float>::infinity(), | 1060 EXPECT_NE(std::numeric_limits<float>::infinity(), |
| 1050 pending_priority.distance_to_visible); | 1061 pending_priority.distance_to_visible); |
| 1051 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) | 1062 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) |
| 1052 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); | 1063 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); |
| 1053 else | 1064 else |
| 1054 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); | 1065 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); |
| 1055 new_content_tiles.insert(tile); | 1066 new_content_tiles.insert(tile); |
| 1056 ++tile_count; | 1067 ++tile_count; |
| 1057 queue->Pop(); | 1068 queue->Pop(); |
| 1058 } | 1069 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 // marked as ready to draw. | 1212 // marked as ready to draw. |
| 1202 if (i == 2) { | 1213 if (i == 2) { |
| 1203 EXPECT_TRUE(queue->IsEmpty()); | 1214 EXPECT_TRUE(queue->IsEmpty()); |
| 1204 continue; | 1215 continue; |
| 1205 } | 1216 } |
| 1206 | 1217 |
| 1207 EXPECT_FALSE(queue->IsEmpty()); | 1218 EXPECT_FALSE(queue->IsEmpty()); |
| 1208 std::set<Tile*> unique_tiles; | 1219 std::set<Tile*> unique_tiles; |
| 1209 unique_tiles.insert(queue->Top()); | 1220 unique_tiles.insert(queue->Top()); |
| 1210 Tile* last_tile = queue->Top(); | 1221 Tile* last_tile = queue->Top(); |
| 1211 have_tiles[last_tile->priority(ACTIVE_TREE).priority_bin] = true; | 1222 have_tiles[last_tile->priority().priority_bin] = true; |
| 1212 | 1223 |
| 1213 // On the second iteration, mark everything as ready to draw (solid color). | 1224 // On the second iteration, mark everything as ready to draw (solid color). |
| 1214 if (i == 1) { | 1225 if (i == 1) { |
| 1215 TileDrawInfo& draw_info = last_tile->draw_info(); | 1226 TileDrawInfo& draw_info = last_tile->draw_info(); |
| 1216 draw_info.SetSolidColorForTesting(SK_ColorRED); | 1227 draw_info.SetSolidColorForTesting(SK_ColorRED); |
| 1217 } | 1228 } |
| 1218 queue->Pop(); | 1229 queue->Pop(); |
| 1219 int eventually_bin_order_correct_count = 0; | 1230 int eventually_bin_order_correct_count = 0; |
| 1220 int eventually_bin_order_incorrect_count = 0; | 1231 int eventually_bin_order_incorrect_count = 0; |
| 1221 while (!queue->IsEmpty()) { | 1232 while (!queue->IsEmpty()) { |
| 1222 Tile* new_tile = queue->Top(); | 1233 Tile* new_tile = queue->Top(); |
| 1223 queue->Pop(); | 1234 queue->Pop(); |
| 1224 unique_tiles.insert(new_tile); | 1235 unique_tiles.insert(new_tile); |
| 1225 | 1236 |
| 1226 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); | 1237 TilePriority last_priority = last_tile->priority(); |
| 1227 TilePriority new_priority = new_tile->priority(ACTIVE_TREE); | 1238 TilePriority new_priority = new_tile->priority(); |
| 1228 EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); | 1239 EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); |
| 1229 if (last_priority.priority_bin == new_priority.priority_bin) { | 1240 if (last_priority.priority_bin == new_priority.priority_bin) { |
| 1230 if (last_priority.priority_bin == TilePriority::EVENTUALLY) { | 1241 if (last_priority.priority_bin == TilePriority::EVENTUALLY) { |
| 1231 bool order_correct = last_priority.distance_to_visible <= | 1242 bool order_correct = last_priority.distance_to_visible <= |
| 1232 new_priority.distance_to_visible; | 1243 new_priority.distance_to_visible; |
| 1233 eventually_bin_order_correct_count += order_correct; | 1244 eventually_bin_order_correct_count += order_correct; |
| 1234 eventually_bin_order_incorrect_count += !order_correct; | 1245 eventually_bin_order_incorrect_count += !order_correct; |
| 1235 } else if (!soon_rect.Intersects(new_tile->content_rect()) && | 1246 } else if (!soon_rect.Intersects(new_tile->content_rect()) && |
| 1236 !soon_rect.Intersects(last_tile->content_rect())) { | 1247 !soon_rect.Intersects(last_tile->content_rect())) { |
| 1237 EXPECT_LE(last_priority.distance_to_visible, | 1248 EXPECT_LE(last_priority.distance_to_visible, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 int eventually_bin_order_correct_count = 0; | 1315 int eventually_bin_order_correct_count = 0; |
| 1305 int eventually_bin_order_incorrect_count = 0; | 1316 int eventually_bin_order_incorrect_count = 0; |
| 1306 scoped_ptr<TilingSetRasterQueueAll> queue( | 1317 scoped_ptr<TilingSetRasterQueueAll> queue( |
| 1307 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1318 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
| 1308 for (; !queue->IsEmpty(); queue->Pop()) { | 1319 for (; !queue->IsEmpty(); queue->Pop()) { |
| 1309 if (!last_tile) | 1320 if (!last_tile) |
| 1310 last_tile = queue->Top(); | 1321 last_tile = queue->Top(); |
| 1311 | 1322 |
| 1312 Tile* new_tile = queue->Top(); | 1323 Tile* new_tile = queue->Top(); |
| 1313 | 1324 |
| 1314 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); | 1325 TilePriority last_priority = last_tile->priority(); |
| 1315 TilePriority new_priority = new_tile->priority(ACTIVE_TREE); | 1326 TilePriority new_priority = new_tile->priority(); |
| 1316 | 1327 |
| 1317 have_tiles[new_priority.priority_bin] = true; | 1328 have_tiles[new_priority.priority_bin] = true; |
| 1318 | 1329 |
| 1319 EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); | 1330 EXPECT_LE(last_priority.priority_bin, new_priority.priority_bin); |
| 1320 if (last_priority.priority_bin == new_priority.priority_bin) { | 1331 if (last_priority.priority_bin == new_priority.priority_bin) { |
| 1321 if (last_priority.priority_bin == TilePriority::EVENTUALLY) { | 1332 if (last_priority.priority_bin == TilePriority::EVENTUALLY) { |
| 1322 bool order_correct = last_priority.distance_to_visible <= | 1333 bool order_correct = last_priority.distance_to_visible <= |
| 1323 new_priority.distance_to_visible; | 1334 new_priority.distance_to_visible; |
| 1324 eventually_bin_order_correct_count += order_correct; | 1335 eventually_bin_order_correct_count += order_correct; |
| 1325 eventually_bin_order_incorrect_count += !order_correct; | 1336 eventually_bin_order_incorrect_count += !order_correct; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 RGBA_8888); | 1418 RGBA_8888); |
| 1408 | 1419 |
| 1409 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); | 1420 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); |
| 1410 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1421 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); |
| 1411 | 1422 |
| 1412 host_impl_.resource_pool()->ReleaseResource(resource.Pass()); | 1423 host_impl_.resource_pool()->ReleaseResource(resource.Pass()); |
| 1413 } | 1424 } |
| 1414 | 1425 |
| 1415 } // namespace | 1426 } // namespace |
| 1416 } // namespace cc | 1427 } // namespace cc |
| OLD | NEW |