Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2978)

Unified Diff: cc/resources/tile_manager.cc

Issue 23231002: cc: Prevent the tile manager from allocating more memory than allowed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/resources_/unused_resources_/ Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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|.

Powered by Google App Engine
This is Rietveld 408576698