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

Unified Diff: cc/resources/resource_pool.h

Issue 817133006: Support different formats in the same resource pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: cc/resources/resource_pool.h
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index e1ee35aa72c6039c01a6ae8e71eb3f4832ffe524..bdbd04bdbb8d046d2dc5ac21935573dee5676d5a 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -6,6 +6,7 @@
#define CC_RESOURCES_RESOURCE_POOL_H_
#include <list>
+#include <map>
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
@@ -20,13 +21,18 @@ class CC_EXPORT ResourcePool {
public:
static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider,
GLenum target,
- ResourceFormat format) {
- return make_scoped_ptr(new ResourcePool(resource_provider, target, format));
+ bool use_memory_efficient_format) {
reveman 2015/01/13 16:25:55 does the resource pool need to know about use_memo
peterp 2015/01/14 12:33:36 The problem then is that when the tile manager ask
+ return make_scoped_ptr(new ResourcePool(resource_provider,
+ target,
+ use_memory_efficient_format));
}
virtual ~ResourcePool();
- scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size);
+ scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size,
+ ResourceFormat format);
+ scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size,
+ ResourceFormatUsage usage);
void ReleaseResource(scoped_ptr<ScopedResource>);
void SetResourceUsageLimits(size_t max_memory_usage_bytes,
@@ -44,17 +50,15 @@ class CC_EXPORT ResourcePool {
return memory_usage_bytes_ - unused_memory_usage_bytes_;
}
size_t total_resource_count() const { return resource_count_; }
- size_t acquired_resource_count() const {
- return resource_count_ - unused_resources_.size();
- }
+ size_t acquired_resource_count() const;
size_t busy_resource_count() const { return busy_resources_.size(); }
- ResourceFormat resource_format() const { return format_; }
+ ResourceFormat resource_format(ResourceFormatUsage usage) const;
protected:
ResourcePool(ResourceProvider* resource_provider,
GLenum target,
- ResourceFormat format);
+ bool use_memory_efficient_format);
bool ResourceUsageTooHigh();
@@ -63,7 +67,7 @@ class CC_EXPORT ResourcePool {
ResourceProvider* resource_provider_;
const GLenum target_;
- const ResourceFormat format_;
+ bool use_memory_efficient_format_;
size_t max_memory_usage_bytes_;
size_t max_unused_memory_usage_bytes_;
size_t max_resource_count_;
@@ -72,7 +76,8 @@ class CC_EXPORT ResourcePool {
size_t resource_count_;
typedef std::list<ScopedResource*> ResourceList;
- ResourceList unused_resources_;
+ typedef std::map<ResourceFormat, ResourceList> UnusedMap;
reveman 2015/01/13 16:25:55 do we need a map for this? can we instead just che
peterp 2015/01/14 12:33:36 You're right, good point. Patch updated.
+ UnusedMap unused_resources_;
ResourceList busy_resources_;
DISALLOW_COPY_AND_ASSIGN(ResourcePool);

Powered by Google App Engine
This is Rietveld 408576698