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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 void TileManager::AssignGpuMemoryToTiles( | 535 void TileManager::AssignGpuMemoryToTiles( |
536 TileVector* tiles_that_need_to_be_rasterized) { | 536 TileVector* tiles_that_need_to_be_rasterized) { |
537 TRACE_EVENT_BEGIN0("cc", "TileManager::AssignGpuMemoryToTiles"); | 537 TRACE_EVENT_BEGIN0("cc", "TileManager::AssignGpuMemoryToTiles"); |
538 | 538 |
539 // Maintain the list of released resources that can potentially be re-used | 539 // Maintain the list of released resources that can potentially be re-used |
540 // or deleted. | 540 // or deleted. |
541 // If this operation becomes expensive too, only do this after some | 541 // If this operation becomes expensive too, only do this after some |
542 // resource(s) was returned. Note that in that case, one also need to | 542 // resource(s) was returned. Note that in that case, one also need to |
543 // invalidate when releasing some resource from the pool. | 543 // invalidate when releasing some resource from the pool. |
544 resource_pool_->CheckBusyResources(); | 544 resource_pool_->CheckBusyResources(false); |
545 | 545 |
546 // Now give memory out to the tiles until we're out, and build | 546 // Now give memory out to the tiles until we're out, and build |
547 // the needs-to-be-rasterized queue. | 547 // the needs-to-be-rasterized queue. |
548 unsigned schedule_priority = 1u; | 548 unsigned schedule_priority = 1u; |
549 all_tiles_that_need_to_be_rasterized_are_scheduled_ = true; | 549 all_tiles_that_need_to_be_rasterized_are_scheduled_ = true; |
550 bool had_enough_memory_to_schedule_tiles_needed_now = true; | 550 bool had_enough_memory_to_schedule_tiles_needed_now = true; |
551 | 551 |
552 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes, | 552 MemoryUsage hard_memory_limit(global_state_.hard_memory_limit_in_bytes, |
553 global_state_.num_resources_limit); | 553 global_state_.num_resources_limit); |
554 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes, | 554 MemoryUsage soft_memory_limit(global_state_.soft_memory_limit_in_bytes, |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 result -= other; | 922 result -= other; |
923 return result; | 923 return result; |
924 } | 924 } |
925 | 925 |
926 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 926 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
927 return memory_bytes_ > limit.memory_bytes_ || | 927 return memory_bytes_ > limit.memory_bytes_ || |
928 resource_count_ > limit.resource_count_; | 928 resource_count_ > limit.resource_count_; |
929 } | 929 } |
930 | 930 |
931 } // namespace cc | 931 } // namespace cc |
OLD | NEW |