| 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 | 9 |
| 10 #include "GrResourceCache2.h" | 10 #include "GrResourceCache2.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 resource = fScratchMap.find(scratchKey, AvailableForScratchUse(false)); | 210 resource = fScratchMap.find(scratchKey, AvailableForScratchUse(false)); |
| 211 if (resource) { | 211 if (resource) { |
| 212 resource->ref(); | 212 resource->ref(); |
| 213 this->makeResourceMRU(resource); | 213 this->makeResourceMRU(resource); |
| 214 this->validate(); | 214 this->validate(); |
| 215 } | 215 } |
| 216 return resource; | 216 return resource; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void GrResourceCache2::willRemoveScratchKey(const GrGpuResource* resource) { | 219 void GrResourceCache2::willRemoveScratchKey(const GrGpuResource* resource) { |
| 220 SkASSERT(resource->cacheAccess().isScratch()); | 220 SkASSERT(resource->cacheAccess().getScratchKey().isValid()); |
| 221 fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource); | 221 fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource); |
| 222 } | 222 } |
| 223 | 223 |
| 224 bool GrResourceCache2::didSetContentKey(GrGpuResource* resource) { | 224 bool GrResourceCache2::didSetContentKey(GrGpuResource* resource) { |
| 225 SkASSERT(!fPurging); | 225 SkASSERT(!fPurging); |
| 226 SkASSERT(resource); | 226 SkASSERT(resource); |
| 227 SkASSERT(this->isInCache(resource)); | 227 SkASSERT(this->isInCache(resource)); |
| 228 SkASSERT(resource->cacheAccess().getContentKey().isValid()); | 228 SkASSERT(resource->cacheAccess().getContentKey().isValid()); |
| 229 | 229 |
| 230 GrGpuResource* res = fContentHash.find(resource->cacheAccess().getContentKey
()); | 230 GrGpuResource* res = fContentHash.find(resource->cacheAccess().getContentKey
()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 516 |
| 517 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 517 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); |
| 518 SkDebugf("\t\tEntry Count: current %d" | 518 SkDebugf("\t\tEntry Count: current %d" |
| 519 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", | 519 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", |
| 520 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); | 520 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); |
| 521 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", | 521 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", |
| 522 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); | 522 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); |
| 523 } | 523 } |
| 524 | 524 |
| 525 #endif | 525 #endif |
| OLD | NEW |