| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 // This should finish all pending tasks and release any uninitialized | 257 // This should finish all pending tasks and release any uninitialized |
| 258 // resources. | 258 // resources. |
| 259 tile_task_runner_->Shutdown(); | 259 tile_task_runner_->Shutdown(); |
| 260 tile_task_runner_->CheckForCompletedTasks(); | 260 tile_task_runner_->CheckForCompletedTasks(); |
| 261 | 261 |
| 262 FreeResourcesForReleasedTiles(); | 262 FreeResourcesForReleasedTiles(); |
| 263 CleanUpReleasedTiles(); | 263 CleanUpReleasedTiles(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void TileManager::RegisterPictureLayerTilingSet( |
| 267 int layer_id, |
| 268 WhichTree tree, |
| 269 PictureLayerTilingSet* tiling_set) { |
| 270 auto& paired_tiling_set = paired_picture_layer_tiling_sets_[layer_id]; |
| 271 if (tree == ACTIVE_TREE) { |
| 272 DCHECK(!paired_tiling_set.active); |
| 273 paired_tiling_set.active = tiling_set; |
| 274 } else { |
| 275 DCHECK(!paired_tiling_set.pending); |
| 276 paired_tiling_set.pending = tiling_set; |
| 277 } |
| 278 } |
| 279 |
| 280 void TileManager::UnregisterPictureLayerTilingSet(int layer_id, |
| 281 WhichTree tree) { |
| 282 auto paired_tiling_set_it = paired_picture_layer_tiling_sets_.find(layer_id); |
| 283 DCHECK(paired_tiling_set_it != paired_picture_layer_tiling_sets_.end()); |
| 284 |
| 285 auto& paired_tiling_set = paired_tiling_set_it->second; |
| 286 if (tree == ACTIVE_TREE) { |
| 287 DCHECK(paired_tiling_set.active); |
| 288 paired_tiling_set.active = nullptr; |
| 289 } else { |
| 290 DCHECK(paired_tiling_set.pending); |
| 291 paired_tiling_set.pending = nullptr; |
| 292 } |
| 293 |
| 294 if (!paired_tiling_set.active && !paired_tiling_set.pending) |
| 295 paired_picture_layer_tiling_sets_.erase(paired_tiling_set_it); |
| 296 } |
| 297 |
| 266 void TileManager::Release(Tile* tile) { | 298 void TileManager::Release(Tile* tile) { |
| 267 released_tiles_.push_back(tile); | 299 released_tiles_.push_back(tile); |
| 268 } | 300 } |
| 269 | 301 |
| 270 TaskSetCollection TileManager::TasksThatShouldBeForcedToComplete() const { | 302 TaskSetCollection TileManager::TasksThatShouldBeForcedToComplete() const { |
| 271 TaskSetCollection tasks_that_should_be_forced_to_complete; | 303 TaskSetCollection tasks_that_should_be_forced_to_complete; |
| 272 if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) | 304 if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY) |
| 273 tasks_that_should_be_forced_to_complete[REQUIRED_FOR_ACTIVATION] = true; | 305 tasks_that_should_be_forced_to_complete[REQUIRED_FOR_ACTIVATION] = true; |
| 274 return tasks_that_should_be_forced_to_complete; | 306 return tasks_that_should_be_forced_to_complete; |
| 275 } | 307 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { | 385 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { |
| 354 tile_task_runner_->CheckForCompletedTasks(); | 386 tile_task_runner_->CheckForCompletedTasks(); |
| 355 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 387 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
| 356 } | 388 } |
| 357 | 389 |
| 358 FreeResourcesForReleasedTiles(); | 390 FreeResourcesForReleasedTiles(); |
| 359 CleanUpReleasedTiles(); | 391 CleanUpReleasedTiles(); |
| 360 | 392 |
| 361 TileVector tiles_that_need_to_be_rasterized; | 393 TileVector tiles_that_need_to_be_rasterized; |
| 362 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( | 394 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( |
| 363 client_->BuildRasterQueue(global_state_.tree_priority, | 395 BuildRasterQueue(RasterTilePriorityQueue::Type::ALL)); |
| 364 RasterTilePriorityQueue::Type::ALL)); | |
| 365 // Inform the client that will likely require a draw if the top tile is | 396 // Inform the client that will likely require a draw if the top tile is |
| 366 // required for draw. | 397 // required for draw. |
| 367 client_->SetIsLikelyToRequireADraw( | 398 client_->SetIsLikelyToRequireADraw( |
| 368 !raster_priority_queue->IsEmpty() && | 399 !raster_priority_queue->IsEmpty() && |
| 369 raster_priority_queue->Top()->required_for_draw()); | 400 raster_priority_queue->Top()->required_for_draw()); |
| 370 AssignGpuMemoryToTiles(raster_priority_queue.get(), | 401 AssignGpuMemoryToTiles(raster_priority_queue.get(), |
| 371 scheduled_raster_task_limit_, | 402 scheduled_raster_task_limit_, |
| 372 &tiles_that_need_to_be_rasterized); | 403 &tiles_that_need_to_be_rasterized); |
| 373 | 404 |
| 374 // Schedule tile tasks. | 405 // Schedule tile tasks. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 437 |
| 407 DCHECK(rasterizer_->GetPrepareTilesMode() != | 438 DCHECK(rasterizer_->GetPrepareTilesMode() != |
| 408 PrepareTilesMode::RASTERIZE_PRIORITIZED_TILES); | 439 PrepareTilesMode::RASTERIZE_PRIORITIZED_TILES); |
| 409 | 440 |
| 410 global_state_ = state; | 441 global_state_ = state; |
| 411 | 442 |
| 412 FreeResourcesForReleasedTiles(); | 443 FreeResourcesForReleasedTiles(); |
| 413 CleanUpReleasedTiles(); | 444 CleanUpReleasedTiles(); |
| 414 | 445 |
| 415 scoped_ptr<RasterTilePriorityQueue> required_for_draw_queue( | 446 scoped_ptr<RasterTilePriorityQueue> required_for_draw_queue( |
| 416 client_->BuildRasterQueue( | 447 BuildRasterQueue(RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); |
| 417 global_state_.tree_priority, | |
| 418 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); | |
| 419 TileVector tiles_that_need_to_be_rasterized; | 448 TileVector tiles_that_need_to_be_rasterized; |
| 420 AssignGpuMemoryToTiles(required_for_draw_queue.get(), | 449 AssignGpuMemoryToTiles(required_for_draw_queue.get(), |
| 421 std::numeric_limits<size_t>::max(), | 450 std::numeric_limits<size_t>::max(), |
| 422 &tiles_that_need_to_be_rasterized); | 451 &tiles_that_need_to_be_rasterized); |
| 423 | 452 |
| 424 // We must reduce the amount of unused resources before calling | 453 // We must reduce the amount of unused resources before calling |
| 425 // RunTasks to prevent usage from rising above limits. | 454 // RunTasks to prevent usage from rising above limits. |
| 426 resource_pool_->ReduceResourceUsage(); | 455 resource_pool_->ReduceResourceUsage(); |
| 427 | 456 |
| 428 // Run and complete all raster task synchronously. | 457 // Run and complete all raster task synchronously. |
| 429 rasterizer_->RasterizeTiles( | 458 rasterizer_->RasterizeTiles( |
| 430 tiles_that_need_to_be_rasterized, resource_pool_, | 459 tiles_that_need_to_be_rasterized, resource_pool_, |
| 431 tile_task_runner_->GetResourceFormat(), | 460 tile_task_runner_->GetResourceFormat(), |
| 432 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this))); | 461 base::Bind(&TileManager::UpdateTileDrawInfo, base::Unretained(this))); |
| 433 | 462 |
| 434 // Use on-demand raster for any required-for-draw tiles that have not been | 463 // Use on-demand raster for any required-for-draw tiles that have not been |
| 435 // assigned memory after reaching a steady memory state. | 464 // assigned memory after reaching a steady memory state. |
| 436 // TODO(hendrikw): Figure out why this would improve jank on some tests - See | 465 // TODO(hendrikw): Figure out why this would improve jank on some tests - See |
| 437 // crbug.com/449288 | 466 // crbug.com/449288 |
| 438 required_for_draw_queue = client_->BuildRasterQueue( | 467 required_for_draw_queue = |
| 439 global_state_.tree_priority, | 468 BuildRasterQueue(RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 440 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | |
| 441 | 469 |
| 442 // Use on-demand raster for any tiles that have not been been assigned | 470 // Use on-demand raster for any tiles that have not been been assigned |
| 443 // memory. This ensures that we draw even when OOM. | 471 // memory. This ensures that we draw even when OOM. |
| 444 for (; !required_for_draw_queue->IsEmpty(); required_for_draw_queue->Pop()) { | 472 for (; !required_for_draw_queue->IsEmpty(); required_for_draw_queue->Pop()) { |
| 445 Tile* tile = required_for_draw_queue->Top(); | 473 Tile* tile = required_for_draw_queue->Top(); |
| 446 tile->draw_info().set_rasterize_on_demand(); | 474 tile->draw_info().set_rasterize_on_demand(); |
| 447 client_->NotifyTileStateChanged(tile); | 475 client_->NotifyTileStateChanged(tile); |
| 448 } | 476 } |
| 449 | 477 |
| 450 TRACE_EVENT_INSTANT1("cc", "DidRasterize", TRACE_EVENT_SCOPE_THREAD, "state", | 478 TRACE_EVENT_INSTANT1("cc", "DidRasterize", TRACE_EVENT_SCOPE_THREAD, "state", |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 global_state_.AsValueInto(state); | 521 global_state_.AsValueInto(state); |
| 494 state->EndDictionary(); | 522 state->EndDictionary(); |
| 495 } | 523 } |
| 496 | 524 |
| 497 scoped_ptr<EvictionTilePriorityQueue> | 525 scoped_ptr<EvictionTilePriorityQueue> |
| 498 TileManager::FreeTileResourcesUntilUsageIsWithinLimit( | 526 TileManager::FreeTileResourcesUntilUsageIsWithinLimit( |
| 499 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 527 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
| 500 const MemoryUsage& limit, | 528 const MemoryUsage& limit, |
| 501 MemoryUsage* usage) { | 529 MemoryUsage* usage) { |
| 502 while (usage->Exceeds(limit)) { | 530 while (usage->Exceeds(limit)) { |
| 503 if (!eviction_priority_queue) { | 531 if (!eviction_priority_queue) |
| 504 eviction_priority_queue = | 532 eviction_priority_queue = BuildEvictionQueue(); |
| 505 client_->BuildEvictionQueue(global_state_.tree_priority); | |
| 506 } | |
| 507 if (eviction_priority_queue->IsEmpty()) | 533 if (eviction_priority_queue->IsEmpty()) |
| 508 break; | 534 break; |
| 509 | 535 |
| 510 Tile* tile = eviction_priority_queue->Top(); | 536 Tile* tile = eviction_priority_queue->Top(); |
| 511 *usage -= MemoryUsage::FromTile(tile); | 537 *usage -= MemoryUsage::FromTile(tile); |
| 512 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); | 538 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); |
| 513 eviction_priority_queue->Pop(); | 539 eviction_priority_queue->Pop(); |
| 514 } | 540 } |
| 515 return eviction_priority_queue; | 541 return eviction_priority_queue; |
| 516 } | 542 } |
| 517 | 543 |
| 518 scoped_ptr<EvictionTilePriorityQueue> | 544 scoped_ptr<EvictionTilePriorityQueue> |
| 519 TileManager::FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 545 TileManager::FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
| 520 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 546 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
| 521 const MemoryUsage& limit, | 547 const MemoryUsage& limit, |
| 522 const TilePriority& other_priority, | 548 const TilePriority& other_priority, |
| 523 MemoryUsage* usage) { | 549 MemoryUsage* usage) { |
| 524 while (usage->Exceeds(limit)) { | 550 while (usage->Exceeds(limit)) { |
| 525 if (!eviction_priority_queue) { | 551 if (!eviction_priority_queue) |
| 526 eviction_priority_queue = | 552 eviction_priority_queue = BuildEvictionQueue(); |
| 527 client_->BuildEvictionQueue(global_state_.tree_priority); | |
| 528 } | |
| 529 if (eviction_priority_queue->IsEmpty()) | 553 if (eviction_priority_queue->IsEmpty()) |
| 530 break; | 554 break; |
| 531 | 555 |
| 532 Tile* tile = eviction_priority_queue->Top(); | 556 Tile* tile = eviction_priority_queue->Top(); |
| 533 if (!other_priority.IsHigherPriorityThan(tile->combined_priority())) | 557 if (!other_priority.IsHigherPriorityThan(tile->combined_priority())) |
| 534 break; | 558 break; |
| 535 | 559 |
| 536 *usage -= MemoryUsage::FromTile(tile); | 560 *usage -= MemoryUsage::FromTile(tile); |
| 537 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); | 561 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); |
| 538 eviction_priority_queue->Pop(); | 562 eviction_priority_queue->Pop(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 891 |
| 868 void TileManager::SetTileTaskRunnerForTesting( | 892 void TileManager::SetTileTaskRunnerForTesting( |
| 869 TileTaskRunner* tile_task_runner) { | 893 TileTaskRunner* tile_task_runner) { |
| 870 tile_task_runner_ = tile_task_runner; | 894 tile_task_runner_ = tile_task_runner; |
| 871 tile_task_runner_->SetClient(this); | 895 tile_task_runner_->SetClient(this); |
| 872 } | 896 } |
| 873 | 897 |
| 874 bool TileManager::AreRequiredTilesReadyToDraw( | 898 bool TileManager::AreRequiredTilesReadyToDraw( |
| 875 RasterTilePriorityQueue::Type type) const { | 899 RasterTilePriorityQueue::Type type) const { |
| 876 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( | 900 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( |
| 877 client_->BuildRasterQueue(global_state_.tree_priority, type)); | 901 BuildRasterQueue(type)); |
| 878 // It is insufficient to check whether the raster queue we constructed is | 902 // It is insufficient to check whether the raster queue we constructed is |
| 879 // empty. The reason for this is that there are situations (rasterize on | 903 // empty. The reason for this is that there are situations (rasterize on |
| 880 // demand) when the tile both needs raster and it's ready to draw. Hence, we | 904 // demand) when the tile both needs raster and it's ready to draw. Hence, we |
| 881 // have to iterate the queue to check whether the required tiles are ready to | 905 // have to iterate the queue to check whether the required tiles are ready to |
| 882 // draw. | 906 // draw. |
| 883 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { | 907 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { |
| 884 if (!raster_priority_queue->Top()->IsReadyToDraw()) | 908 if (!raster_priority_queue->Top()->IsReadyToDraw()) |
| 885 return false; | 909 return false; |
| 886 } | 910 } |
| 887 return true; | 911 return true; |
| 888 } | 912 } |
| 889 bool TileManager::IsReadyToActivate() const { | 913 bool TileManager::IsReadyToActivate() const { |
| 890 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); | 914 TRACE_EVENT0("cc", "TileManager::IsReadyToActivate"); |
| 891 return AreRequiredTilesReadyToDraw( | 915 return AreRequiredTilesReadyToDraw( |
| 892 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); | 916 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 893 } | 917 } |
| 894 | 918 |
| 895 bool TileManager::IsReadyToDraw() const { | 919 bool TileManager::IsReadyToDraw() const { |
| 896 TRACE_EVENT0("cc", "TileManager::IsReadyToDraw"); | 920 TRACE_EVENT0("cc", "TileManager::IsReadyToDraw"); |
| 897 return AreRequiredTilesReadyToDraw( | 921 return AreRequiredTilesReadyToDraw( |
| 898 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 922 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 899 } | 923 } |
| 900 | 924 |
| 925 scoped_ptr<RasterTilePriorityQueue> TileManager::BuildRasterQueue( |
| 926 RasterTilePriorityQueue::Type type) const { |
| 927 TRACE_EVENT0("cc", "TileManager::BuildRasterQueue"); |
| 928 return RasterTilePriorityQueue::Create(paired_picture_layer_tiling_sets_, |
| 929 client_->PendingTreeExists(), |
| 930 global_state_.tree_priority, type); |
| 931 } |
| 932 |
| 933 scoped_ptr<EvictionTilePriorityQueue> TileManager::BuildEvictionQueue() const { |
| 934 TRACE_EVENT0("cc", "TileManager::BuildEvictionQueue"); |
| 935 return EvictionTilePriorityQueue::Create(paired_picture_layer_tiling_sets_, |
| 936 client_->PendingTreeExists(), |
| 937 global_state_.tree_priority); |
| 938 } |
| 939 |
| 901 void TileManager::NotifyReadyToActivate() { | 940 void TileManager::NotifyReadyToActivate() { |
| 902 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate"); | 941 TRACE_EVENT0("cc", "TileManager::NotifyReadyToActivate"); |
| 903 if (did_notify_ready_to_activate_) | 942 if (did_notify_ready_to_activate_) |
| 904 return; | 943 return; |
| 905 client_->NotifyReadyToActivate(); | 944 client_->NotifyReadyToActivate(); |
| 906 did_notify_ready_to_activate_ = true; | 945 did_notify_ready_to_activate_ = true; |
| 907 } | 946 } |
| 908 | 947 |
| 909 void TileManager::NotifyReadyToDraw() { | 948 void TileManager::NotifyReadyToDraw() { |
| 910 TRACE_EVENT0("cc", "TileManager::NotifyReadyToDraw"); | 949 TRACE_EVENT0("cc", "TileManager::NotifyReadyToDraw"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 982 } |
| 944 | 983 |
| 945 void TileManager::CheckIfMoreTilesNeedToBePrepared() { | 984 void TileManager::CheckIfMoreTilesNeedToBePrepared() { |
| 946 tile_task_runner_->CheckForCompletedTasks(); | 985 tile_task_runner_->CheckForCompletedTasks(); |
| 947 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 986 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
| 948 | 987 |
| 949 // When OOM, keep re-assigning memory until we reach a steady state | 988 // When OOM, keep re-assigning memory until we reach a steady state |
| 950 // where top-priority tiles are initialized. | 989 // where top-priority tiles are initialized. |
| 951 TileVector tiles_that_need_to_be_rasterized; | 990 TileVector tiles_that_need_to_be_rasterized; |
| 952 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( | 991 scoped_ptr<RasterTilePriorityQueue> raster_priority_queue( |
| 953 client_->BuildRasterQueue(global_state_.tree_priority, | 992 BuildRasterQueue(RasterTilePriorityQueue::Type::ALL)); |
| 954 RasterTilePriorityQueue::Type::ALL)); | |
| 955 AssignGpuMemoryToTiles(raster_priority_queue.get(), | 993 AssignGpuMemoryToTiles(raster_priority_queue.get(), |
| 956 scheduled_raster_task_limit_, | 994 scheduled_raster_task_limit_, |
| 957 &tiles_that_need_to_be_rasterized); | 995 &tiles_that_need_to_be_rasterized); |
| 958 | 996 |
| 959 // |tiles_that_need_to_be_rasterized| will be empty when we reach a | 997 // |tiles_that_need_to_be_rasterized| will be empty when we reach a |
| 960 // steady memory state. Keep scheduling tasks until we reach this state. | 998 // steady memory state. Keep scheduling tasks until we reach this state. |
| 961 if (!tiles_that_need_to_be_rasterized.empty()) { | 999 if (!tiles_that_need_to_be_rasterized.empty()) { |
| 962 ScheduleTasks(tiles_that_need_to_be_rasterized); | 1000 ScheduleTasks(tiles_that_need_to_be_rasterized); |
| 963 return; | 1001 return; |
| 964 } | 1002 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 977 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY && | 1015 global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY && |
| 978 global_state_.memory_limit_policy != ALLOW_NOTHING; | 1016 global_state_.memory_limit_policy != ALLOW_NOTHING; |
| 979 | 1017 |
| 980 // Use on-demand raster for any required-for-activation tiles that have | 1018 // Use on-demand raster for any required-for-activation tiles that have |
| 981 // not been been assigned memory after reaching a steady memory state. This | 1019 // not been been assigned memory after reaching a steady memory state. This |
| 982 // ensures that we activate even when OOM. Note that we can't reuse the queue | 1020 // ensures that we activate even when OOM. Note that we can't reuse the queue |
| 983 // we used for AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call | 1021 // we used for AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call |
| 984 // could have evicted some tiles that would not be picked up by the old raster | 1022 // could have evicted some tiles that would not be picked up by the old raster |
| 985 // queue. | 1023 // queue. |
| 986 scoped_ptr<RasterTilePriorityQueue> required_for_activation_queue( | 1024 scoped_ptr<RasterTilePriorityQueue> required_for_activation_queue( |
| 987 client_->BuildRasterQueue( | 1025 BuildRasterQueue(RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); |
| 988 global_state_.tree_priority, | |
| 989 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); | |
| 990 | 1026 |
| 991 // If we have tiles to mark as rasterize on demand, but we don't allow | 1027 // If we have tiles to mark as rasterize on demand, but we don't allow |
| 992 // rasterize on demand, then skip activation and return early. | 1028 // rasterize on demand, then skip activation and return early. |
| 993 if (!required_for_activation_queue->IsEmpty() && !allow_rasterize_on_demand) | 1029 if (!required_for_activation_queue->IsEmpty() && !allow_rasterize_on_demand) |
| 994 return; | 1030 return; |
| 995 | 1031 |
| 996 // Mark required tiles as rasterize on demand. | 1032 // Mark required tiles as rasterize on demand. |
| 997 for (; !required_for_activation_queue->IsEmpty(); | 1033 for (; !required_for_activation_queue->IsEmpty(); |
| 998 required_for_activation_queue->Pop()) { | 1034 required_for_activation_queue->Pop()) { |
| 999 Tile* tile = required_for_activation_queue->Top(); | 1035 Tile* tile = required_for_activation_queue->Top(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 result -= other; | 1085 result -= other; |
| 1050 return result; | 1086 return result; |
| 1051 } | 1087 } |
| 1052 | 1088 |
| 1053 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1089 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 1054 return memory_bytes_ > limit.memory_bytes_ || | 1090 return memory_bytes_ > limit.memory_bytes_ || |
| 1055 resource_count_ > limit.resource_count_; | 1091 resource_count_ > limit.resource_count_; |
| 1056 } | 1092 } |
| 1057 | 1093 |
| 1058 } // namespace cc | 1094 } // namespace cc |
| OLD | NEW |