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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 !mts.tile_versions[mts.raster_mode].raster_task_) { | 671 !mts.tile_versions[mts.raster_mode].raster_task_) { |
672 FreeResourcesForTile(tile); | 672 FreeResourcesForTile(tile); |
673 continue; | 673 continue; |
674 } | 674 } |
675 | 675 |
676 // Insert the tile into a priority set. | 676 // Insert the tile into a priority set. |
677 tiles->InsertTile(tile, mts.bin); | 677 tiles->InsertTile(tile, mts.bin); |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
681 void TileManager::CleanUpLayers() { | |
682 for (size_t i = 0; i < layers_.size(); ++i) { | |
683 if (layers_[i]->IsDrawnRenderSurfaceLayerListMember()) | |
684 continue; | |
685 | |
686 layers_[i]->DidUnregisterLayer(); | |
687 std::swap(layers_[i], layers_.back()); | |
688 layers_.pop_back(); | |
689 --i; | |
690 prioritized_tiles_dirty_ = true; | |
691 } | |
692 } | |
693 | |
694 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { | 681 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { |
695 TRACE_EVENT0("cc", "TileManager::ManageTiles"); | 682 TRACE_EVENT0("cc", "TileManager::ManageTiles"); |
696 | 683 |
697 // Update internal state. | 684 // Update internal state. |
698 if (state != global_state_) { | 685 if (state != global_state_) { |
699 global_state_ = state; | 686 global_state_ = state; |
700 prioritized_tiles_dirty_ = true; | 687 prioritized_tiles_dirty_ = true; |
701 } | 688 } |
702 | 689 |
703 CleanUpLayers(); | |
704 | |
705 // We need to call CheckForCompletedTasks() once in-between each call | 690 // We need to call CheckForCompletedTasks() once in-between each call |
706 // to ScheduleTasks() to prevent canceled tasks from being scheduled. | 691 // to ScheduleTasks() to prevent canceled tasks from being scheduled. |
707 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { | 692 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { |
708 rasterizer_delegate_->CheckForCompletedTasks(); | 693 rasterizer_delegate_->CheckForCompletedTasks(); |
709 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 694 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
710 } | 695 } |
711 | 696 |
712 UpdatePrioritizedTileSetIfNeeded(); | 697 UpdatePrioritizedTileSetIfNeeded(); |
713 | 698 |
714 TileVector tiles_that_need_to_be_rasterized; | 699 TileVector tiles_that_need_to_be_rasterized; |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 | 1610 |
1626 if (b_priority.resolution != a_priority.resolution) { | 1611 if (b_priority.resolution != a_priority.resolution) { |
1627 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) || | 1612 return (prioritize_low_res && b_priority.resolution == LOW_RESOLUTION) || |
1628 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) || | 1613 (!prioritize_low_res && b_priority.resolution == HIGH_RESOLUTION) || |
1629 (a_priority.resolution == NON_IDEAL_RESOLUTION); | 1614 (a_priority.resolution == NON_IDEAL_RESOLUTION); |
1630 } | 1615 } |
1631 return a_priority.IsHigherPriorityThan(b_priority); | 1616 return a_priority.IsHigherPriorityThan(b_priority); |
1632 } | 1617 } |
1633 | 1618 |
1634 } // namespace cc | 1619 } // namespace cc |
OLD | NEW |