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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/containers/scoped_ptr_map.h" | 10 #include "base/containers/scoped_ptr_map.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 base::TimeTicks GetUsageTimeForLRUResource() const; | 111 base::TimeTicks GetUsageTimeForLRUResource() const; |
112 | 112 |
113 ResourceProvider* resource_provider_; | 113 ResourceProvider* resource_provider_; |
114 const GLenum target_; | 114 const GLenum target_; |
115 size_t max_memory_usage_bytes_; | 115 size_t max_memory_usage_bytes_; |
116 size_t max_resource_count_; | 116 size_t max_resource_count_; |
117 size_t in_use_memory_usage_bytes_; | 117 size_t in_use_memory_usage_bytes_; |
118 size_t total_memory_usage_bytes_; | 118 size_t total_memory_usage_bytes_; |
119 size_t total_resource_count_; | 119 size_t total_resource_count_; |
120 | 120 |
| 121 // Holds most recently used resources at the front of the queue. |
121 using ResourceDeque = ScopedPtrDeque<PoolResource>; | 122 using ResourceDeque = ScopedPtrDeque<PoolResource>; |
122 ResourceDeque unused_resources_; | 123 ResourceDeque unused_resources_; |
123 ResourceDeque busy_resources_; | 124 ResourceDeque busy_resources_; |
124 | 125 |
125 using ResourceMap = base::ScopedPtrMap<ResourceId, scoped_ptr<PoolResource>>; | 126 using ResourceMap = base::ScopedPtrMap<ResourceId, scoped_ptr<PoolResource>>; |
126 ResourceMap in_use_resources_; | 127 ResourceMap in_use_resources_; |
127 | 128 |
128 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 129 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
129 bool evict_expired_resources_pending_; | 130 bool evict_expired_resources_pending_; |
130 base::TimeDelta resource_expiration_delay_; | 131 base::TimeDelta resource_expiration_delay_; |
131 | 132 |
132 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; | 133 base::WeakPtrFactory<ResourcePool> weak_ptr_factory_; |
133 | 134 |
134 DISALLOW_COPY_AND_ASSIGN(ResourcePool); | 135 DISALLOW_COPY_AND_ASSIGN(ResourcePool); |
135 }; | 136 }; |
136 | 137 |
137 } // namespace cc | 138 } // namespace cc |
138 | 139 |
139 #endif // CC_RESOURCES_RESOURCE_POOL_H_ | 140 #endif // CC_RESOURCES_RESOURCE_POOL_H_ |
OLD | NEW |