| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 !mts.tile_versions[mts.raster_mode].raster_task_) { | 678 !mts.tile_versions[mts.raster_mode].raster_task_) { |
| 679 FreeResourcesForTile(tile); | 679 FreeResourcesForTile(tile); |
| 680 continue; | 680 continue; |
| 681 } | 681 } |
| 682 | 682 |
| 683 // Insert the tile into a priority set. | 683 // Insert the tile into a priority set. |
| 684 tiles->InsertTile(tile, mts.bin); | 684 tiles->InsertTile(tile, mts.bin); |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 | 687 |
| 688 void TileManager::CleanUpLayers() { |
| 689 for (size_t i = 0; i < layers_.size(); ++i) { |
| 690 if (layers_[i]->IsDrawnRenderSurfaceLayerListMember()) |
| 691 continue; |
| 692 |
| 693 layers_[i]->DidUnregisterLayer(); |
| 694 std::swap(layers_[i], layers_.back()); |
| 695 layers_.pop_back(); |
| 696 --i; |
| 697 prioritized_tiles_dirty_ = true; |
| 698 } |
| 699 } |
| 700 |
| 688 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { | 701 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { |
| 689 TRACE_EVENT0("cc", "TileManager::ManageTiles"); | 702 TRACE_EVENT0("cc", "TileManager::ManageTiles"); |
| 690 | 703 |
| 691 // Update internal state. | 704 // Update internal state. |
| 692 if (state != global_state_) { | 705 if (state != global_state_) { |
| 693 global_state_ = state; | 706 global_state_ = state; |
| 694 prioritized_tiles_dirty_ = true; | 707 prioritized_tiles_dirty_ = true; |
| 695 } | 708 } |
| 696 | 709 |
| 710 CleanUpLayers(); |
| 711 |
| 697 // We need to call CheckForCompletedTasks() once in-between each call | 712 // We need to call CheckForCompletedTasks() once in-between each call |
| 698 // to ScheduleTasks() to prevent canceled tasks from being scheduled. | 713 // to ScheduleTasks() to prevent canceled tasks from being scheduled. |
| 699 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { | 714 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { |
| 700 rasterizer_delegate_->CheckForCompletedTasks(); | 715 rasterizer_delegate_->CheckForCompletedTasks(); |
| 701 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 716 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
| 702 } | 717 } |
| 703 | 718 |
| 704 UpdatePrioritizedTileSetIfNeeded(); | 719 UpdatePrioritizedTileSetIfNeeded(); |
| 705 | 720 |
| 706 TileVector tiles_that_need_to_be_rasterized; | 721 TileVector tiles_that_need_to_be_rasterized; |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 | 1641 |
| 1627 if (b_priority.resolution != a_priority.resolution) { | 1642 if (b_priority.resolution != a_priority.resolution) { |
| 1628 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) || | 1643 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) || |
| 1629 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) || | 1644 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) || |
| 1630 (a_priority.resolution == NON_IDEAL_RESOLUTION); | 1645 (a_priority.resolution == NON_IDEAL_RESOLUTION); |
| 1631 } | 1646 } |
| 1632 return a_priority.IsHigherPriorityThan(b_priority); | 1647 return a_priority.IsHigherPriorityThan(b_priority); |
| 1633 } | 1648 } |
| 1634 | 1649 |
| 1635 } // namespace cc | 1650 } // namespace cc |
| OLD | NEW |