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