Chromium Code Reviews| Index: cc/resources/resource_pool.cc |
| diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc |
| index cef86ded1788d770100d996a1b2d2afc3de42718..2eacf248bee8e14fe552f0d8f1a3a756a578f722 100644 |
| --- a/cc/resources/resource_pool.cc |
| +++ b/cc/resources/resource_pool.cc |
| @@ -82,7 +82,11 @@ void ResourcePool::ReleaseResource( |
| } |
| unused_memory_usage_bytes_ += resource->bytes(); |
|
reveman
2013/10/31 19:41:49
This needs to be moved to CheckConsumedResources()
|
| - unused_resources_.push_back(resource.release()); |
| + |
| + if (resource_provider_->InUseByConsumer(resource->id())) |
|
reveman
2013/10/30 14:56:02
Can we remove this check and always add released r
danakj
2013/10/30 15:12:40
Yes you can RP holds onto it until it comes back f
reveman
2013/10/30 18:50:47
I assume this is a reply to the above comment abou
jadahl
2013/10/31 08:38:42
As far as I can see, this should be fine, as we al
reveman
2013/10/31 19:41:49
Yes, let's remove the ResourceUsageTooHigh() code
|
| + consumed_resources_.push_back(resource.release()); |
| + else |
| + unused_resources_.push_back(resource.release()); |
| } |
| void ResourcePool::SetResourceUsageLimits( |
| @@ -127,4 +131,16 @@ bool ResourcePool::ResourceUsageTooHigh() { |
| return false; |
| } |
| +void ResourcePool::CheckConsumedResources() { |
| + ResourceList::iterator it = consumed_resources_.begin(); |
| + while (it != consumed_resources_.end()) { |
|
reveman
2013/10/30 14:56:02
nit: consider using a temporary "Resource* resourc
|
| + if (!resource_provider_->InUseByConsumer((*it)->id())) { |
| + unused_resources_.push_back(*it); |
| + it = consumed_resources_.erase(it); |
| + } else { |
| + ++it; |
| + } |
| + } |
| +} |
| + |
| } // namespace cc |