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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 priority, &memory_usage); | 632 priority, &memory_usage); |
633 bool memory_usage_is_within_limit = | 633 bool memory_usage_is_within_limit = |
634 !memory_usage.Exceeds(scheduled_tile_memory_limit); | 634 !memory_usage.Exceeds(scheduled_tile_memory_limit); |
635 | 635 |
636 // If we couldn't fit the tile into our current memory limit, then we're | 636 // If we couldn't fit the tile into our current memory limit, then we're |
637 // done. | 637 // done. |
638 if (!memory_usage_is_within_limit) { | 638 if (!memory_usage_is_within_limit) { |
639 if (tile_is_needed_now) | 639 if (tile_is_needed_now) |
640 had_enough_memory_to_schedule_tiles_needed_now = false; | 640 had_enough_memory_to_schedule_tiles_needed_now = false; |
641 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 641 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
642 // OOM, clear cache (applicable in gpu-raster case) | |
643 rasterizer_->ClearCache(); | |
sohanjg
2015/03/17 11:20:18
Will this be the only place to clear cache when OO
vmiura
2015/03/19 21:20:35
I don't think this is the OOM condition where we s
sohanjg
2015/03/23 10:34:38
Acknowledged.
vmiura
2015/03/23 20:34:39
I'm not sure this is actually what we want to do.
| |
642 break; | 644 break; |
643 } | 645 } |
644 | 646 |
645 memory_usage += memory_required_by_tile_to_be_scheduled; | 647 memory_usage += memory_required_by_tile_to_be_scheduled; |
646 tiles_that_need_to_be_rasterized->push_back(tile); | 648 tiles_that_need_to_be_rasterized->push_back(tile); |
647 } | 649 } |
648 | 650 |
649 // Note that we should try and further reduce memory in case the above loop | 651 // Note that we should try and further reduce memory in case the above loop |
650 // didn't reduce memory. This ensures that we always release as many resources | 652 // didn't reduce memory. This ensures that we always release as many resources |
651 // as possible to stay within the memory limit. | 653 // as possible to stay within the memory limit. |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 result -= other; | 1050 result -= other; |
1049 return result; | 1051 return result; |
1050 } | 1052 } |
1051 | 1053 |
1052 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1054 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1053 return memory_bytes_ > limit.memory_bytes_ || | 1055 return memory_bytes_ > limit.memory_bytes_ || |
1054 resource_count_ > limit.resource_count_; | 1056 resource_count_ > limit.resource_count_; |
1055 } | 1057 } |
1056 | 1058 |
1057 } // namespace cc | 1059 } // namespace cc |
OLD | NEW |