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

Unified Diff: cc/resources/resource_pool.cc

Issue 43753002: cc: Keep track of busy resources in ResourcePool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc: Keep track of resources used by consumers in ResourcePool Created 7 years, 2 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/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

Powered by Google App Engine
This is Rietveld 408576698