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

Unified Diff: cc/resources/resource_pool.h

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: rebase 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
« no previous file with comments | « no previous file | cc/resources/resource_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_pool.h
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index 309bf33f30b0873f50059780dae77efffdc0b0b3..771650ecdfc0a385c50310736bc434ad390303be 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -40,9 +40,11 @@ class CC_EXPORT ResourcePool {
GLenum format);
void ReleaseResource(scoped_ptr<ResourcePool::Resource>);
- void SetMemoryUsageLimits(size_t max_memory_usage_bytes,
- size_t max_unused_memory_usage_bytes,
- size_t num_resources_limit);
+ void SetResourceUsageLimits(size_t max_memory_usage_bytes,
+ size_t max_unused_memory_usage_bytes,
+ size_t max_resource_count);
+
+ void ReduceResourceUsage();
size_t total_memory_usage_bytes() const {
return memory_usage_bytes_;
@@ -50,23 +52,26 @@ class CC_EXPORT ResourcePool {
size_t acquired_memory_usage_bytes() const {
return memory_usage_bytes_ - unused_memory_usage_bytes_;
}
- size_t NumResources() const { return resources_.size(); }
+ size_t acquired_resource_count() const {
+ return resource_count_ - unused_resources_.size();
+ }
protected:
explicit ResourcePool(ResourceProvider* resource_provider);
- bool MemoryUsageTooHigh();
+ bool ResourceUsageTooHigh();
private:
ResourceProvider* resource_provider_;
size_t max_memory_usage_bytes_;
size_t max_unused_memory_usage_bytes_;
+ size_t max_resource_count_;
size_t memory_usage_bytes_;
size_t unused_memory_usage_bytes_;
- size_t num_resources_limit_;
+ size_t resource_count_;
typedef std::list<Resource*> ResourceList;
- ResourceList resources_;
+ ResourceList unused_resources_;
DISALLOW_COPY_AND_ASSIGN(ResourcePool);
};
« no previous file with comments | « no previous file | cc/resources/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698