Chromium Code Reviews| Index: cc/resources/tile_manager.cc |
| diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
| index 7cf5096ce3b0db931de4b92c56b4b1bd4a54f9f0..8ece30bb0f0594a27a0b330af6ec29c61ba7a9cf 100644 |
| --- a/cc/resources/tile_manager.cc |
| +++ b/cc/resources/tile_manager.cc |
| @@ -509,9 +509,10 @@ void TileManager::AssignGpuMemoryToTiles( |
| static_cast<int64>(bytes_releasable) + |
| static_cast<int64>(global_state_.memory_limit_in_bytes) - |
| static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); |
| - int resources_available = resources_releasable + |
| - global_state_.num_resources_limit - |
| - resource_pool_->NumResources(); |
| + int resources_available = |
| + resources_releasable + |
| + global_state_.num_resources_limit - |
| + resource_pool_->acquired_resource_count(); |
| size_t bytes_allocatable = |
| std::max(static_cast<int64>(0), bytes_available); |
| @@ -709,6 +710,10 @@ void TileManager::ScheduleTasks( |
| tasks.Append(tile_version.raster_task_, tile->required_for_activation()); |
| } |
| + // We must reduce the amount of unused memory before calling |
| + // ScheduleTasks to prevent usage from rising above limit. |
| + resource_pool_->ReduceMemoryUsage(); |
|
vmpstr
2013/08/15 18:26:37
I'm not sure I follow this. Wouldn't we want to Re
reveman
2013/08/15 19:13:55
ScheduleTasks can't create new resources. It can o
|
| + |
| // Schedule running of |tasks|. This replaces any previously |
| // scheduled tasks and effectively cancels all tasks not present |
| // in |tasks|. |