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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void removeResource(GrGpuResource*); | 160 void removeResource(GrGpuResource*); |
161 void notifyPurgable(GrGpuResource*); | 161 void notifyPurgable(GrGpuResource*); |
162 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); | 162 void didChangeGpuMemorySize(const GrGpuResource*, size_t oldSize); |
163 bool didSetContentKey(GrGpuResource*); | 163 bool didSetContentKey(GrGpuResource*); |
164 void willRemoveScratchKey(const GrGpuResource*); | 164 void willRemoveScratchKey(const GrGpuResource*); |
165 void didChangeBudgetStatus(GrGpuResource*); | 165 void didChangeBudgetStatus(GrGpuResource*); |
166 void makeResourceMRU(GrGpuResource*); | 166 void makeResourceMRU(GrGpuResource*); |
167 /// @} | 167 /// @} |
168 | 168 |
169 void purgeAsNeeded() { | 169 void purgeAsNeeded() { |
170 if (fPurging || (fBudgetedCount <= fMaxCount && fBudgetedBytes < fMaxByt
es)) { | 170 if (fPurging || (fBudgetedCount <= fMaxCount && fBudgetedBytes <= fMaxBy
tes)) { |
171 return; | 171 return; |
172 } | 172 } |
173 this->internalPurgeAsNeeded(); | 173 this->internalPurgeAsNeeded(); |
174 } | 174 } |
175 | 175 |
176 void internalPurgeAsNeeded(); | 176 void internalPurgeAsNeeded(); |
177 | 177 |
178 #ifdef SK_DEBUG | 178 #ifdef SK_DEBUG |
179 bool isInCache(const GrGpuResource* r) const { return fResources.isInList(r)
; } | 179 bool isInCache(const GrGpuResource* r) const { return fResources.isInList(r)
; } |
180 void validate() const; | 180 void validate() const; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 friend class GrGpuResource; // To access all the proxy inline methods. | 299 friend class GrGpuResource; // To access all the proxy inline methods. |
300 friend class GrResourceCache2; // To create this type. | 300 friend class GrResourceCache2; // To create this type. |
301 }; | 301 }; |
302 | 302 |
303 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { | 303 inline GrResourceCache2::ResourceAccess GrResourceCache2::resourceAccess() { |
304 return ResourceAccess(this); | 304 return ResourceAccess(this); |
305 } | 305 } |
306 | 306 |
307 #endif | 307 #endif |
OLD | NEW |