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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 DISALLOW_COPY_AND_ASSIGN(Resource); | 30 DISALLOW_COPY_AND_ASSIGN(Resource); |
31 }; | 31 }; |
32 | 32 |
33 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider) { | 33 static scoped_ptr<ResourcePool> Create(ResourceProvider* resource_provider) { |
34 return make_scoped_ptr(new ResourcePool(resource_provider)); | 34 return make_scoped_ptr(new ResourcePool(resource_provider)); |
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(size_t max_memory_usage_bytes); |
46 | 46 |
47 protected: | 47 protected: |
48 ResourcePool(ResourceProvider* resource_provider); | 48 explicit ResourcePool(ResourceProvider* resource_provider); |
49 | 49 |
50 private: | 50 private: |
51 ResourceProvider* resource_provider_; | 51 ResourceProvider* resource_provider_; |
52 size_t max_memory_usage_bytes_; | 52 size_t max_memory_usage_bytes_; |
53 size_t memory_usage_bytes_; | 53 size_t memory_usage_bytes_; |
54 | 54 |
55 typedef std::list<Resource*> ResourceList; | 55 typedef std::list<Resource*> ResourceList; |
56 ResourceList resources_; | 56 ResourceList resources_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 58 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace cc | 61 } // namespace cc |
62 | 62 |
63 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 63 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
OLD | NEW |