| 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 GrResourceCache_DEFINED | 9 #ifndef GrResourceCache_DEFINED |
| 10 #define GrResourceCache_DEFINED | 10 #define GrResourceCache_DEFINED |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 void notifyFlushOccurred(); | 183 void notifyFlushOccurred(); |
| 184 | 184 |
| 185 #if GR_CACHE_STATS | 185 #if GR_CACHE_STATS |
| 186 struct Stats { | 186 struct Stats { |
| 187 int fTotal; | 187 int fTotal; |
| 188 int fNumPurgeable; | 188 int fNumPurgeable; |
| 189 int fNumNonPurgeable; | 189 int fNumNonPurgeable; |
| 190 | 190 |
| 191 int fScratch; | 191 int fScratch; |
| 192 int fExternal; | 192 int fExternal; |
| 193 int fBorrowed; | |
| 194 int fAdopted; | |
| 195 size_t fUnbudgetedSize; | 193 size_t fUnbudgetedSize; |
| 196 | 194 |
| 197 Stats() { this->reset(); } | 195 Stats() { this->reset(); } |
| 198 | 196 |
| 199 void reset() { | 197 void reset() { |
| 200 fTotal = 0; | 198 fTotal = 0; |
| 201 fNumPurgeable = 0; | 199 fNumPurgeable = 0; |
| 202 fNumNonPurgeable = 0; | 200 fNumNonPurgeable = 0; |
| 203 fScratch = 0; | 201 fScratch = 0; |
| 204 fExternal = 0; | 202 fExternal = 0; |
| 205 fBorrowed = 0; | |
| 206 fAdopted = 0; | |
| 207 fUnbudgetedSize = 0; | 203 fUnbudgetedSize = 0; |
| 208 } | 204 } |
| 209 | 205 |
| 210 void update(GrGpuResource* resource) { | 206 void update(GrGpuResource* resource) { |
| 211 if (resource->cacheAccess().isScratch()) { | 207 if (resource->cacheAccess().isScratch()) { |
| 212 ++fScratch; | 208 ++fScratch; |
| 213 } | 209 } |
| 214 if (resource->resourcePriv().isExternal()) { | 210 if (resource->resourcePriv().refsWrappedResources()) { |
| 215 ++fExternal; | 211 ++fExternal; |
| 216 } | 212 } |
| 217 if (resource->cacheAccess().isBorrowed()) { | |
| 218 ++fBorrowed; | |
| 219 } | |
| 220 if (resource->cacheAccess().isAdopted()) { | |
| 221 ++fAdopted; | |
| 222 } | |
| 223 if (SkBudgeted::kNo == resource->resourcePriv().isBudgeted()) { | 213 if (SkBudgeted::kNo == resource->resourcePriv().isBudgeted()) { |
| 224 fUnbudgetedSize += resource->gpuMemorySize(); | 214 fUnbudgetedSize += resource->gpuMemorySize(); |
| 225 } | 215 } |
| 226 } | 216 } |
| 227 }; | 217 }; |
| 228 | 218 |
| 229 void getStats(Stats*) const; | 219 void getStats(Stats*) const; |
| 230 | 220 |
| 231 void dumpStats(SkString*) const; | 221 void dumpStats(SkString*) const; |
| 232 | 222 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 421 |
| 432 friend class GrGpuResource; // To access all the proxy inline methods. | 422 friend class GrGpuResource; // To access all the proxy inline methods. |
| 433 friend class GrResourceCache; // To create this type. | 423 friend class GrResourceCache; // To create this type. |
| 434 }; | 424 }; |
| 435 | 425 |
| 436 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 426 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { |
| 437 return ResourceAccess(this); | 427 return ResourceAccess(this); |
| 438 } | 428 } |
| 439 | 429 |
| 440 #endif | 430 #endif |
| OLD | NEW |