| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrResourceCache2_DEFINED | 9 #ifndef GrResourceCache2_DEFINED |
| 10 #define GrResourceCache2_DEFINED | 10 #define GrResourceCache2_DEFINED |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #if GR_GPU_STATS | 141 #if GR_GPU_STATS |
| 142 void printStats() const; | 142 void printStats() const; |
| 143 #endif | 143 #endif |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 /////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////// |
| 147 /// @name Methods accessible via ResourceAccess | 147 /// @name Methods accessible via ResourceAccess |
| 148 //// | 148 //// |
| 149 void insertResource(GrGpuResource*); | 149 void insertResource(GrGpuResource*); |
| 150 void removeResource(GrGpuResource*); | 150 void removeResource(GrGpuResource*); |
| 151 void notifyPurgable(const GrGpuResource*); | 151 void notifyPurgable(GrGpuResource*); |
| 152 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); | 152 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); |
| 153 bool didSetContentKey(GrGpuResource*); | 153 bool didSetContentKey(GrGpuResource*); |
| 154 void makeResourceMRU(GrGpuResource*); | 154 void makeResourceMRU(GrGpuResource*); |
| 155 /// @} | 155 /// @} |
| 156 | 156 |
| 157 void purgeAsNeeded() { | 157 void purgeAsNeeded() { |
| 158 if (fPurging || (fCount <= fMaxCount && fBytes < fMaxBytes)) { | 158 if (fPurging || (fCount <= fMaxCount && fBytes < fMaxBytes)) { |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 this->internalPurgeAsNeeded(); | 161 this->internalPurgeAsNeeded(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 void insertResource(GrGpuResource* resource) { fCache->insertResource(resour
ce); } | 234 void insertResource(GrGpuResource* resource) { fCache->insertResource(resour
ce); } |
| 235 | 235 |
| 236 /** | 236 /** |
| 237 * Removes a resource from the cache. | 237 * Removes a resource from the cache. |
| 238 */ | 238 */ |
| 239 void removeResource(GrGpuResource* resource) { fCache->removeResource(resour
ce); } | 239 void removeResource(GrGpuResource* resource) { fCache->removeResource(resour
ce); } |
| 240 | 240 |
| 241 /** | 241 /** |
| 242 * Called by GrGpuResources when they detects that they are newly purgable. | 242 * Called by GrGpuResources when they detects that they are newly purgable. |
| 243 */ | 243 */ |
| 244 void notifyPurgable(const GrGpuResource* resource) { fCache->notifyPurgable(
resource); } | 244 void notifyPurgable(GrGpuResource* resource) { fCache->notifyPurgable(resour
ce); } |
| 245 | 245 |
| 246 /** | 246 /** |
| 247 * Called by GrGpuResources when their sizes change. | 247 * Called by GrGpuResources when their sizes change. |
| 248 */ | 248 */ |
| 249 void didChangeGpuMemorySize(const GrGpuResource* resource, size_t oldSize) { | 249 void didChangeGpuMemorySize(const GrGpuResource* resource, size_t oldSize) { |
| 250 fCache->didChangeGpuMemorySize(resource, oldSize); | 250 fCache->didChangeGpuMemorySize(resource, oldSize); |
| 251 } | 251 } |
| 252 | 252 |
| 253 /** | 253 /** |
| 254 * Called by GrGpuResources when their content keys change. | 254 * Called by GrGpuResources when their content keys change. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 268 | 268 |
| 269 friend class GrGpuResource; // To access all the proxy inline methods. | 269 friend class GrGpuResource; // To access all the proxy inline methods. |
| 270 friend class GrResourceCache2; // To create this type. | 270 friend class GrResourceCache2; // To create this type. |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { | 273 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { |
| 274 return ResourceAccess(this); | 274 return ResourceAccess(this); |
| 275 } | 275 } |
| 276 | 276 |
| 277 #endif | 277 #endif |
| OLD | NEW |