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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 global_state_.memory_limit_in_bytes; | 619 global_state_.memory_limit_in_bytes; |
620 memory_stats_from_last_assign_.bytes_allocated = | 620 memory_stats_from_last_assign_.bytes_allocated = |
621 bytes_allocatable - bytes_left; | 621 bytes_allocatable - bytes_left; |
622 memory_stats_from_last_assign_.bytes_unreleasable = | 622 memory_stats_from_last_assign_.bytes_unreleasable = |
623 bytes_allocatable - bytes_releasable_; | 623 bytes_allocatable - bytes_releasable_; |
624 memory_stats_from_last_assign_.bytes_over = | 624 memory_stats_from_last_assign_.bytes_over = |
625 bytes_that_exceeded_memory_budget; | 625 bytes_that_exceeded_memory_budget; |
626 } | 626 } |
627 | 627 |
628 void TileManager::CleanUpUnusedImageDecodeTasks() { | 628 void TileManager::CleanUpUnusedImageDecodeTasks() { |
| 629 if (image_decode_tasks_.empty()) |
| 630 return; |
| 631 |
629 // Calculate a set of layers that are used by at least one tile. | 632 // Calculate a set of layers that are used by at least one tile. |
630 base::hash_set<int> used_layers; | 633 base::hash_set<int> used_layers; |
631 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 634 for (TileMap::iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
632 used_layers.insert(it->second->layer_id()); | 635 used_layers.insert(it->second->layer_id()); |
633 | 636 |
634 // Now calculate the set of layers in |image_decode_tasks_| that are not used | 637 // Now calculate the set of layers in |image_decode_tasks_| that are not used |
635 // by any tile. | 638 // by any tile. |
636 std::vector<int> unused_layers; | 639 std::vector<int> unused_layers; |
637 for (LayerPixelRefTaskMap::iterator it = image_decode_tasks_.begin(); | 640 for (LayerPixelRefTaskMap::iterator it = image_decode_tasks_.begin(); |
638 it != image_decode_tasks_.end(); | 641 it != image_decode_tasks_.end(); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 bytes_releasable_ += tile->bytes_consumed_if_allocated(); | 851 bytes_releasable_ += tile->bytes_consumed_if_allocated(); |
849 ++resources_releasable_; | 852 ++resources_releasable_; |
850 } | 853 } |
851 | 854 |
852 FreeUnusedResourcesForTile(tile); | 855 FreeUnusedResourcesForTile(tile); |
853 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) | 856 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) |
854 did_initialize_visible_tile_ = true; | 857 did_initialize_visible_tile_ = true; |
855 } | 858 } |
856 | 859 |
857 } // namespace cc | 860 } // namespace cc |
OLD | NEW |