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

Unified Diff: cc/resources/resource_pool.h

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_format.cc ('k') | 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 e1ee35aa72c6039c01a6ae8e71eb3f4832ffe524..1c7f46883411eda03417ab814d8fdefb80cf6585 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,17 @@ 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) {
+ 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 +49,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 +66,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 +75,8 @@ class CC_EXPORT ResourcePool {
size_t resource_count_;
typedef std::list<ScopedResource*> ResourceList;
- ResourceList unused_resources_;
+ typedef std::map<ResourceFormat, ResourceList> UnusedMap;
+ UnusedMap unused_resources_;
ResourceList busy_resources_;
DISALLOW_COPY_AND_ASSIGN(ResourcePool);
« no previous file with comments | « cc/resources/resource_format.cc ('k') | cc/resources/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698