| 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_PRIORITIZED_RESOURCE_MANAGER_H_ | 5 #ifndef CC_PRIORITIZED_RESOURCE_MANAGER_H_ |
| 6 #define CC_PRIORITIZED_RESOURCE_MANAGER_H_ | 6 #define CC_PRIORITIZED_RESOURCE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } // namespace BASE_HASH_NAMESPACE | 30 } // namespace BASE_HASH_NAMESPACE |
| 31 #endif // COMPILER | 31 #endif // COMPILER |
| 32 | 32 |
| 33 namespace cc { | 33 namespace cc { |
| 34 | 34 |
| 35 class PriorityCalculator; | 35 class PriorityCalculator; |
| 36 class Proxy; | 36 class Proxy; |
| 37 | 37 |
| 38 class CC_EXPORT PrioritizedResourceManager { | 38 class CC_EXPORT PrioritizedResourceManager { |
| 39 public: | 39 public: |
| 40 static scoped_ptr<PrioritizedResourceManager> create(size_t maxMemoryLimitBy
tes, int maxTextureSize, int pool, const Proxy* proxy) | 40 static scoped_ptr<PrioritizedResourceManager> create(int pool, const Proxy*
proxy) |
| 41 { | 41 { |
| 42 return make_scoped_ptr(new PrioritizedResourceManager(maxMemoryLimitByte
s, maxTextureSize, pool, proxy)); | 42 return make_scoped_ptr(new PrioritizedResourceManager(pool, proxy)); |
| 43 } | 43 } |
| 44 scoped_ptr<PrioritizedResource> createTexture(gfx::Size size, GLenum format) | 44 scoped_ptr<PrioritizedResource> createTexture(gfx::Size size, GLenum format) |
| 45 { | 45 { |
| 46 return make_scoped_ptr(new PrioritizedResource(this, size, format)); | 46 return make_scoped_ptr(new PrioritizedResource(this, size, format)); |
| 47 } | 47 } |
| 48 ~PrioritizedResourceManager(); | 48 ~PrioritizedResourceManager(); |
| 49 | 49 |
| 50 typedef std::list<PrioritizedResource::Backing*> BackingList; | 50 typedef std::list<PrioritizedResource::Backing*> BackingList; |
| 51 | 51 |
| 52 // FIXME (http://crbug.com/137094): This 64MB default is a straggler from th
e | 52 // FIXME (http://crbug.com/137094): This 64MB default is a straggler from th
e |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Then sort by priority (note that backings that no longer have owners
will | 139 // Then sort by priority (note that backings that no longer have owners
will |
| 140 // always have the lowest priority) | 140 // always have the lowest priority) |
| 141 if (a->requestPriorityAtLastPriorityUpdate() != b->requestPriorityAtLast
PriorityUpdate()) | 141 if (a->requestPriorityAtLastPriorityUpdate() != b->requestPriorityAtLast
PriorityUpdate()) |
| 142 return PriorityCalculator::priorityIsLower(a->requestPriorityAtLastP
riorityUpdate(), b->requestPriorityAtLastPriorityUpdate()); | 142 return PriorityCalculator::priorityIsLower(a->requestPriorityAtLastP
riorityUpdate(), b->requestPriorityAtLastPriorityUpdate()); |
| 143 // Finally sort by being in the impl tree versus being completely unrefe
renced | 143 // Finally sort by being in the impl tree versus being completely unrefe
renced |
| 144 if (a->inDrawingImplTree() != b->inDrawingImplTree()) | 144 if (a->inDrawingImplTree() != b->inDrawingImplTree()) |
| 145 return (a->inDrawingImplTree() < b->inDrawingImplTree()); | 145 return (a->inDrawingImplTree() < b->inDrawingImplTree()); |
| 146 return a < b; | 146 return a < b; |
| 147 } | 147 } |
| 148 | 148 |
| 149 PrioritizedResourceManager(size_t maxMemoryLimitBytes, int maxTextureSize, i
nt pool, const Proxy* proxy); | 149 PrioritizedResourceManager(int pool, const Proxy* proxy); |
| 150 | 150 |
| 151 bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, Evic
tionPolicy, ResourceProvider*); | 151 bool evictBackingsToReduceMemory(size_t limitBytes, int priorityCutoff, Evic
tionPolicy, ResourceProvider*); |
| 152 PrioritizedResource::Backing* createBacking(gfx::Size, GLenum format, Resour
ceProvider*); | 152 PrioritizedResource::Backing* createBacking(gfx::Size, GLenum format, Resour
ceProvider*); |
| 153 void evictFirstBackingResource(ResourceProvider*); | 153 void evictFirstBackingResource(ResourceProvider*); |
| 154 void deleteUnlinkedEvictedBackings(); | 154 void deleteUnlinkedEvictedBackings(); |
| 155 void sortBackings(); | 155 void sortBackings(); |
| 156 | 156 |
| 157 void assertInvariants(); | 157 void assertInvariants(); |
| 158 | 158 |
| 159 size_t m_maxMemoryLimitBytes; | 159 size_t m_maxMemoryLimitBytes; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Statistics copied at the time of pushTexturePrioritiesToBackings. | 191 // Statistics copied at the time of pushTexturePrioritiesToBackings. |
| 192 size_t m_memoryVisibleLastPushedBytes; | 192 size_t m_memoryVisibleLastPushedBytes; |
| 193 size_t m_memoryVisibleAndNearbyLastPushedBytes; | 193 size_t m_memoryVisibleAndNearbyLastPushedBytes; |
| 194 | 194 |
| 195 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); | 195 DISALLOW_COPY_AND_ASSIGN(PrioritizedResourceManager); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 } // namespace cc | 198 } // namespace cc |
| 199 | 199 |
| 200 #endif // CC_PRIORITIZED_RESOURCE_MANAGER_H_ | 200 #endif // CC_PRIORITIZED_RESOURCE_MANAGER_H_ |
| OLD | NEW |