| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_RESOURCES_RESOURCE_POOL_H_ | 5 #ifndef CC_RESOURCES_RESOURCE_POOL_H_ |
| 6 #define CC_RESOURCES_RESOURCE_POOL_H_ | 6 #define CC_RESOURCES_RESOURCE_POOL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/output/renderer.h" | 12 #include "cc/output/renderer.h" |
| 13 #include "cc/resources/resource.h" | 13 #include "cc/resources/resource.h" |
| 14 #include "cc/resources/resource_format.h" | 14 #include "cc/resources/resource_format.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 class ScopedResource; | 17 class ScopedResource; |
| 18 | 18 |
| 19 class CC_EXPORT ResourcePool { | 19 class CC_EXPORT ResourcePool { |
| 20 public: | 20 public: |
| 21 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider, | 21 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider, |
| 22 GLenum target, | 22 GLenum target, |
| 23 ResourceFormat format) { | 23 ResourceFormat format) { |
| 24 return make_scoped_ptr(new ResourcePool(resource_provider, target, format)); | 24 return make_scoped_ptr(new ResourcePool(resource_provider, target, format)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual ~ResourcePool(); | 27 virtual ~ResourcePool(); |
| 28 | 28 |
| 29 scoped_ptr<ScopedResource> AcquireResource(const gfx::Size& size); | 29 scoped_ptr<ScopedResource> AcquireResource(gfx::Size size); |
| 30 void ReleaseResource(scoped_ptr<ScopedResource>); | 30 void ReleaseResource(scoped_ptr<ScopedResource>); |
| 31 | 31 |
| 32 void SetResourceUsageLimits(size_t max_memory_usage_bytes, | 32 void SetResourceUsageLimits(size_t max_memory_usage_bytes, |
| 33 size_t max_unused_memory_usage_bytes, | 33 size_t max_unused_memory_usage_bytes, |
| 34 size_t max_resource_count); | 34 size_t max_resource_count); |
| 35 | 35 |
| 36 void ReduceResourceUsage(); | 36 void ReduceResourceUsage(); |
| 37 void CheckBusyResources(); | 37 void CheckBusyResources(); |
| 38 | 38 |
| 39 size_t total_memory_usage_bytes() const { return memory_usage_bytes_; } | 39 size_t total_memory_usage_bytes() const { return memory_usage_bytes_; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 typedef std::list<ScopedResource*> ResourceList; | 67 typedef std::list<ScopedResource*> ResourceList; |
| 68 ResourceList unused_resources_; | 68 ResourceList unused_resources_; |
| 69 ResourceList busy_resources_; | 69 ResourceList busy_resources_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 71 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace cc | 74 } // namespace cc |
| 75 | 75 |
| 76 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 76 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
| OLD | NEW |