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