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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 MemoryUsage* usage) { | 523 MemoryUsage* usage) { |
524 while (usage->Exceeds(limit)) { | 524 while (usage->Exceeds(limit)) { |
525 if (!eviction_priority_queue) { | 525 if (!eviction_priority_queue) { |
526 eviction_priority_queue = | 526 eviction_priority_queue = |
527 client_->BuildEvictionQueue(global_state_.tree_priority); | 527 client_->BuildEvictionQueue(global_state_.tree_priority); |
528 } | 528 } |
529 if (eviction_priority_queue->IsEmpty()) | 529 if (eviction_priority_queue->IsEmpty()) |
530 break; | 530 break; |
531 | 531 |
532 Tile* tile = eviction_priority_queue->Top(); | 532 Tile* tile = eviction_priority_queue->Top(); |
533 if (!other_priority.IsHigherPriorityThan(tile->combined_priority())) | 533 const TilePriority& eviction_priority = tile->combined_priority(); |
534 | |
535 // If eviction tile is strictly higher priority, then we can't evict. | |
536 if (eviction_priority.IsHigherPriorityThan(other_priority)) | |
534 break; | 537 break; |
535 | 538 |
539 // If there's a tie in priority, prefer to the keep the eviction tile | |
540 // unless it's non ideal resolution or is occluded. | |
541 if (!tile->is_occluded_combined() && | |
542 (eviction_priority.resolution != NON_IDEAL_RESOLUTION) && | |
danakj
2015/02/12 23:48:46
I think you should do this separately with a test
vmpstr
2015/02/12 23:52:34
OK. Removed from this CL.
| |
543 !other_priority.IsHigherPriorityThan(tile->combined_priority())) { | |
544 break; | |
545 } | |
546 | |
536 *usage -= MemoryUsage::FromTile(tile); | 547 *usage -= MemoryUsage::FromTile(tile); |
537 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); | 548 FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(tile); |
538 eviction_priority_queue->Pop(); | 549 eviction_priority_queue->Pop(); |
539 } | 550 } |
540 return eviction_priority_queue; | 551 return eviction_priority_queue; |
541 } | 552 } |
542 | 553 |
543 bool TileManager::TilePriorityViolatesMemoryPolicy( | 554 bool TileManager::TilePriorityViolatesMemoryPolicy( |
544 const TilePriority& priority) { | 555 const TilePriority& priority) { |
545 switch (global_state_.memory_limit_policy) { | 556 switch (global_state_.memory_limit_policy) { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 result -= other; | 1060 result -= other; |
1050 return result; | 1061 return result; |
1051 } | 1062 } |
1052 | 1063 |
1053 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1064 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1054 return memory_bytes_ > limit.memory_bytes_ || | 1065 return memory_bytes_ > limit.memory_bytes_ || |
1055 resource_count_ > limit.resource_count_; | 1066 resource_count_ > limit.resource_count_; |
1056 } | 1067 } |
1057 | 1068 |
1058 } // namespace cc | 1069 } // namespace cc |
OLD | NEW |