| 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 29 matching lines...) Expand all Loading... |
| 40 static scoped_ptr<PrioritizedResourceManager> Create(const Proxy* proxy) { | 40 static scoped_ptr<PrioritizedResourceManager> Create(const Proxy* proxy) { |
| 41 return make_scoped_ptr(new PrioritizedResourceManager(proxy)); | 41 return make_scoped_ptr(new PrioritizedResourceManager(proxy)); |
| 42 } | 42 } |
| 43 scoped_ptr<PrioritizedResource> CreateTexture(gfx::Size size, GLenum format) { | 43 scoped_ptr<PrioritizedResource> CreateTexture(gfx::Size size, GLenum 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: |
| 54 // - wait for the callback before rendering anything instead | 54 // - wait for the callback before rendering anything instead |
| 55 // - push this into the GPU memory manager somehow. | 55 // - push this into the GPU memory manager somehow. |
| 56 static size_t DefaultMemoryAllocationLimit() { return 64 * 1024 * 1024; } | 56 static size_t DefaultMemoryAllocationLimit() { return 64 * 1024 * 1024; } |
| 57 | 57 |
| 58 // MemoryUseBytes() describes the number of bytes used by existing allocated | 58 // MemoryUseBytes() describes the number of bytes used by existing allocated |
| 59 // textures. MemoryAboveCutoffBytes() describes the number of bytes that | 59 // textures. MemoryAboveCutoffBytes() describes the number of bytes that |
| 60 // would be used if all textures that are above the cutoff were allocated. | 60 // would be used if all textures that are above the cutoff were allocated. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 return PriorityCalculator::priority_is_lower( | 164 return PriorityCalculator::priority_is_lower( |
| 165 a->request_priority_at_last_priority_update(), | 165 a->request_priority_at_last_priority_update(), |
| 166 b->request_priority_at_last_priority_update()); | 166 b->request_priority_at_last_priority_update()); |
| 167 // Finally sort by being in the impl tree versus being completely | 167 // Finally sort by being in the impl tree versus being completely |
| 168 // unreferenced | 168 // unreferenced |
| 169 if (a->in_drawing_impl_tree() != b->in_drawing_impl_tree()) | 169 if (a->in_drawing_impl_tree() != b->in_drawing_impl_tree()) |
| 170 return (a->in_drawing_impl_tree() < b->in_drawing_impl_tree()); | 170 return (a->in_drawing_impl_tree() < b->in_drawing_impl_tree()); |
| 171 return a < b; | 171 return a < b; |
| 172 } | 172 } |
| 173 | 173 |
| 174 PrioritizedResourceManager(const Proxy* proxy); | 174 explicit PrioritizedResourceManager(const Proxy* proxy); |
| 175 | 175 |
| 176 bool EvictBackingsToReduceMemory(size_t limit_bytes, | 176 bool EvictBackingsToReduceMemory(size_t limit_bytes, |
| 177 int priority_cutoff, | 177 int priority_cutoff, |
| 178 EvictionPolicy eviction_policy, | 178 EvictionPolicy eviction_policy, |
| 179 UnlinkPolicy unlink_policy, | 179 UnlinkPolicy unlink_policy, |
| 180 ResourceProvider* resource_provider); | 180 ResourceProvider* resource_provider); |
| 181 PrioritizedResource::Backing* CreateBacking( | 181 PrioritizedResource::Backing* CreateBacking( |
| 182 gfx::Size size, | 182 gfx::Size size, |
| 183 GLenum format, | 183 GLenum format, |
| 184 ResourceProvider* resource_provider); | 184 ResourceProvider* resource_provider); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // Statistics copied at the time of PushTexturePrioritiesToBackings. | 227 // Statistics copied at the time of PushTexturePrioritiesToBackings. |
| 228 size_t memory_visible_last_pushed_bytes_; | 228 size_t memory_visible_last_pushed_bytes_; |
| 229 size_t memory_visible_and_nearby_last_pushed_bytes_; | 229 size_t memory_visible_and_nearby_last_pushed_bytes_; |
| 230 | 230 |
| 231 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); | 231 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 } // namespace cc | 234 } // namespace cc |
| 235 | 235 |
| 236 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ | 236 #endif // CC_RESOURCES_PRIORITIZED_RESOURCE_MANAGER_H_ |
| OLD | NEW |