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

Unified Diff: cc/resources/resource_pool.cc

Issue 817133006: Support different formats in the same resource pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a TODO about removing the default format. Created 5 years, 11 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 | « cc/resources/resource_pool.h ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_pool.cc
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index 45f36e27816d04451e1f92e786dcf21911fd3f34..f0a871df754b62cc5c3fb079ee424ba3ccae5ed4 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -11,10 +11,10 @@ namespace cc {
ResourcePool::ResourcePool(ResourceProvider* resource_provider,
GLenum target,
- ResourceFormat format)
+ ResourceFormat default_format)
: resource_provider_(resource_provider),
target_(target),
- format_(format),
+ default_format_(default_format),
max_memory_usage_bytes_(0),
max_unused_memory_usage_bytes_(0),
max_resource_count_(0),
@@ -36,13 +36,15 @@ ResourcePool::~ResourcePool() {
}
scoped_ptr<ScopedResource> ResourcePool::AcquireResource(
- const gfx::Size& size) {
+ const gfx::Size& size, ResourceFormat format) {
for (ResourceList::iterator it = unused_resources_.begin();
it != unused_resources_.end();
++it) {
ScopedResource* resource = *it;
DCHECK(resource_provider_->CanLockForWrite(resource->id()));
+ if (resource->format() != format)
+ continue;
if (resource->size() != size)
continue;
@@ -53,7 +55,7 @@ scoped_ptr<ScopedResource> ResourcePool::AcquireResource(
scoped_ptr<ScopedResource> resource =
ScopedResource::Create(resource_provider_);
- resource->AllocateManaged(size, target_, format_);
+ resource->AllocateManaged(size, target_, format);
memory_usage_bytes_ += resource->bytes();
++resource_count_;
« no previous file with comments | « cc/resources/resource_pool.h ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698