OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 10 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } while (!withinBudget && changed); | 347 } while (!withinBudget && changed); |
348 } | 348 } |
349 | 349 |
350 void GrResourceCache::purgeAllUnlocked() { | 350 void GrResourceCache::purgeAllUnlocked() { |
351 GrAutoResourceCacheValidate atcv(this); | 351 GrAutoResourceCacheValidate atcv(this); |
352 | 352 |
353 // we can have one GrResource holding a lock on another | 353 // we can have one GrResource holding a lock on another |
354 // so we don't want to just do a simple loop kicking each | 354 // so we don't want to just do a simple loop kicking each |
355 // entry out. Instead change the budget and purge. | 355 // entry out. Instead change the budget and purge. |
356 | 356 |
357 int savedMaxBytes = fMaxBytes; | 357 size_t savedMaxBytes = fMaxBytes; |
358 int savedMaxCount = fMaxCount; | 358 int savedMaxCount = fMaxCount; |
359 fMaxBytes = (size_t) -1; | 359 fMaxBytes = (size_t) -1; |
360 fMaxCount = 0; | 360 fMaxCount = 0; |
361 this->purgeAsNeeded(); | 361 this->purgeAsNeeded(); |
362 | 362 |
363 #ifdef SK_DEBUG | 363 #ifdef SK_DEBUG |
364 SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount); | 364 SkASSERT(fExclusiveList.countEntries() == fClientDetachedCount); |
365 SkASSERT(countBytes(fExclusiveList) == fClientDetachedBytes); | 365 SkASSERT(countBytes(fExclusiveList) == fClientDetachedBytes); |
366 if (!fCache.count()) { | 366 if (!fCache.count()) { |
367 // Items may have been detached from the cache (such as the backing | 367 // Items may have been detached from the cache (such as the backing |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 fEntryBytes, fHighWaterEntryBytes); | 465 fEntryBytes, fHighWaterEntryBytes); |
466 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", | 466 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", |
467 fClientDetachedCount, fHighWaterClientDetachedCount); | 467 fClientDetachedCount, fHighWaterClientDetachedCount); |
468 SkDebugf("\t\tDetached Bytes: current %d high %d\n", | 468 SkDebugf("\t\tDetached Bytes: current %d high %d\n", |
469 fClientDetachedBytes, fHighWaterClientDetachedBytes); | 469 fClientDetachedBytes, fHighWaterClientDetachedBytes); |
470 } | 470 } |
471 | 471 |
472 #endif | 472 #endif |
473 | 473 |
474 /////////////////////////////////////////////////////////////////////////////// | 474 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |