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_PRIORITIZED_RESOURCE_MANAGER_H_ | 5 #ifndef CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ |
6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ | 6 #define CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 class PriorityCalculator; | 34 class PriorityCalculator; |
35 class Proxy; | 35 class Proxy; |
36 | 36 |
37 class CC_EXPORT PrioritizedResourceManager { | 37 class CC_EXPORT PrioritizedResourceManager { |
38 public: | 38 public: |
39 static scoped_ptr<PrioritizedResourceManager> Create(const Proxy* proxy) { | 39 static scoped_ptr<PrioritizedResourceManager> Create(const Proxy* proxy) { |
40 return make_scoped_ptr(new PrioritizedResourceManager(proxy)); | 40 return make_scoped_ptr(new PrioritizedResourceManager(proxy)); |
41 } | 41 } |
42 scoped_ptr<PrioritizedResource> CreateTexture( | 42 scoped_ptr<PrioritizedResource> CreateTexture( |
43 const gfx::Size& size, ResourceFormat format) { | 43 gfx::Size size, ResourceFormat format) { |
44 return make_scoped_ptr(new PrioritizedResource(this, size, format)); | 44 return make_scoped_ptr(new PrioritizedResource(this, size, format)); |
45 } | 45 } |
46 ~PrioritizedResourceManager(); | 46 ~PrioritizedResourceManager(); |
47 | 47 |
48 typedef std::list<PrioritizedResource::Backing*> BackingList; | 48 typedef std::list<PrioritizedResource::Backing*> BackingList; |
49 | 49 |
50 // TODO(epenner): (http://crbug.com/137094) This 64MB default is a straggler | 50 // TODO(epenner): (http://crbug.com/137094) This 64MB default is a straggler |
51 // from the old texture manager and is just to give us a default memory | 51 // from the old texture manager and is just to give us a default memory |
52 // allocation before we get a callback from the GPU memory manager. We | 52 // allocation before we get a callback from the GPU memory manager. We |
53 // should probaby either: | 53 // should probaby either: |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 explicit PrioritizedResourceManager(const Proxy* proxy); | 184 explicit PrioritizedResourceManager(const Proxy* proxy); |
185 | 185 |
186 bool EvictBackingsToReduceMemory(size_t limit_bytes, | 186 bool EvictBackingsToReduceMemory(size_t limit_bytes, |
187 int priority_cutoff, | 187 int priority_cutoff, |
188 EvictionPolicy eviction_policy, | 188 EvictionPolicy eviction_policy, |
189 UnlinkPolicy unlink_policy, | 189 UnlinkPolicy unlink_policy, |
190 ResourceProvider* resource_provider); | 190 ResourceProvider* resource_provider); |
191 PrioritizedResource::Backing* CreateBacking( | 191 PrioritizedResource::Backing* CreateBacking( |
192 const gfx::Size& size, | 192 gfx::Size size, |
193 ResourceFormat format, | 193 ResourceFormat format, |
194 ResourceProvider* resource_provider); | 194 ResourceProvider* resource_provider); |
195 void EvictFirstBackingResource(ResourceProvider* resource_provider); | 195 void EvictFirstBackingResource(ResourceProvider* resource_provider); |
196 void SortBackings(); | 196 void SortBackings(); |
197 | 197 |
198 void AssertInvariants(); | 198 void AssertInvariants(); |
199 | 199 |
200 size_t max_memory_limit_bytes_; | 200 size_t max_memory_limit_bytes_; |
201 // The priority cutoff based on memory pressure. This is not a strict | 201 // The priority cutoff based on memory pressure. This is not a strict |
202 // cutoff -- RequestLate allows textures with priority equal to this | 202 // cutoff -- RequestLate allows textures with priority equal to this |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Statistics copied at the time of PushTexturePrioritiesToBackings. | 238 // Statistics copied at the time of PushTexturePrioritiesToBackings. |
239 size_t memory_visible_last_pushed_bytes_; | 239 size_t memory_visible_last_pushed_bytes_; |
240 size_t memory_visible_and_nearby_last_pushed_bytes_; | 240 size_t memory_visible_and_nearby_last_pushed_bytes_; |
241 | 241 |
242 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); | 242 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); |
243 }; | 243 }; |
244 | 244 |
245 } // namespace cc | 245 } // namespace cc |
246 | 246 |
247 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ | 247 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ |
OLD | NEW |