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 26 matching lines...) Expand all Loading... |
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_; } |
40 size_t acquired_memory_usage_bytes() const { | 40 size_t acquired_memory_usage_bytes() const { |
41 return memory_usage_bytes_ - unused_memory_usage_bytes_; | 41 return memory_usage_bytes_ - unused_memory_usage_bytes_; |
42 } | 42 } |
43 size_t acquired_resource_count() const { | 43 size_t acquired_resource_count() const { |
44 return resource_count_ - unused_resources_.size(); | 44 return resource_count_ - unused_resources_.size(); |
45 } | 45 } |
46 | 46 |
| 47 ResourceFormat resource_format() const { return format_; } |
| 48 |
47 protected: | 49 protected: |
48 ResourcePool(ResourceProvider* resource_provider, | 50 ResourcePool(ResourceProvider* resource_provider, |
49 GLenum target, | 51 GLenum target, |
50 ResourceFormat format); | 52 ResourceFormat format); |
51 | 53 |
52 bool ResourceUsageTooHigh(); | 54 bool ResourceUsageTooHigh(); |
53 | 55 |
54 private: | 56 private: |
55 void DidFinishUsingResource(ScopedResource* resource); | 57 void DidFinishUsingResource(ScopedResource* resource); |
56 | 58 |
(...skipping 10 matching lines...) Expand all Loading... |
67 typedef std::list<ScopedResource*> ResourceList; | 69 typedef std::list<ScopedResource*> ResourceList; |
68 ResourceList unused_resources_; | 70 ResourceList unused_resources_; |
69 ResourceList busy_resources_; | 71 ResourceList busy_resources_; |
70 | 72 |
71 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 73 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace cc | 76 } // namespace cc |
75 | 77 |
76 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 78 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
OLD | NEW |