| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual ~ResourcePool(); | 37 virtual ~ResourcePool(); |
| 38 | 38 |
| 39 ResourceProvider* resource_provider() { return resource_provider_; } | 39 ResourceProvider* resource_provider() { return resource_provider_; } |
| 40 | 40 |
| 41 scoped_ptr<ResourcePool::Resource> AcquireResource( | 41 scoped_ptr<ResourcePool::Resource> AcquireResource( |
| 42 const gfx::Size&, GLenum format); | 42 const gfx::Size&, GLenum format); |
| 43 void ReleaseResource(scoped_ptr<ResourcePool::Resource>); | 43 void ReleaseResource(scoped_ptr<ResourcePool::Resource>); |
| 44 | 44 |
| 45 void SetMaxMemoryUsageBytes(size_t max_memory_usage_bytes); | 45 void SetMaxMemoryUsageBytes( |
| 46 size_t max_memory_usage_bytes, |
| 47 size_t max_unused_memory_usage_bytes); |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 explicit ResourcePool(ResourceProvider* resource_provider); | 50 explicit ResourcePool(ResourceProvider* resource_provider); |
| 49 | 51 |
| 52 bool MemoryUsageTooHigh(); |
| 53 |
| 50 private: | 54 private: |
| 51 ResourceProvider* resource_provider_; | 55 ResourceProvider* resource_provider_; |
| 52 size_t max_memory_usage_bytes_; | 56 size_t max_memory_usage_bytes_; |
| 57 size_t max_unused_memory_usage_bytes_; |
| 53 size_t memory_usage_bytes_; | 58 size_t memory_usage_bytes_; |
| 59 size_t unused_memory_usage_bytes_; |
| 54 | 60 |
| 55 typedef std::list<Resource*> ResourceList; | 61 typedef std::list<Resource*> ResourceList; |
| 56 ResourceList resources_; | 62 ResourceList resources_; |
| 57 | 63 |
| 58 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 64 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
| 59 }; | 65 }; |
| 60 | 66 |
| 61 } // namespace cc | 67 } // namespace cc |
| 62 | 68 |
| 63 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 69 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
| OLD | NEW |