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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 fInvalidationInbox.poll(&invalidated); | 305 fInvalidationInbox.poll(&invalidated); |
306 | 306 |
307 for (int i = 0; i < invalidated.count(); i++) { | 307 for (int i = 0; i < invalidated.count(); i++) { |
308 // We're somewhat missing an opportunity here. We could use the | 308 // We're somewhat missing an opportunity here. We could use the |
309 // default find functor that gives us back resources whether we own | 309 // default find functor that gives us back resources whether we own |
310 // them exclusively or not, and when they're not exclusively owned mark | 310 // them exclusively or not, and when they're not exclusively owned mark |
311 // them for purging later when they do become exclusively owned. | 311 // them for purging later when they do become exclusively owned. |
312 // | 312 // |
313 // This is complicated and confusing. May try this in the future. For | 313 // This is complicated and confusing. May try this in the future. For |
314 // now, these resources are just LRU'd as if we never got the message. | 314 // now, these resources are just LRU'd as if we never got the message. |
315 GrResourceEntry* entry = fCache.find(invalidated[i].key, GrTFindUnreffed
Functor()); | 315 GrResourceEntry* entry; |
316 if (entry) { | 316 while ((entry= fCache.find(invalidated[i].key, GrTFindUnreffedFunctor())
)) { |
317 this->deleteResource(entry); | 317 this->deleteResource(entry); |
318 } | 318 } |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 void GrResourceCache::deleteResource(GrResourceEntry* entry) { | 322 void GrResourceCache::deleteResource(GrResourceEntry* entry) { |
323 SkASSERT(1 == entry->fResource->getRefCnt()); | 323 SkASSERT(1 == entry->fResource->getRefCnt()); |
324 | 324 |
325 // remove from our cache | 325 // remove from our cache |
326 fCache.remove(entry->key(), entry); | 326 fCache.remove(entry->key(), entry); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 fEntryBytes, fHighWaterEntryBytes); | 486 fEntryBytes, fHighWaterEntryBytes); |
487 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", | 487 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", |
488 fClientDetachedCount, fHighWaterClientDetachedCount); | 488 fClientDetachedCount, fHighWaterClientDetachedCount); |
489 SkDebugf("\t\tDetached Bytes: current %d high %d\n", | 489 SkDebugf("\t\tDetached Bytes: current %d high %d\n", |
490 fClientDetachedBytes, fHighWaterClientDetachedBytes); | 490 fClientDetachedBytes, fHighWaterClientDetachedBytes); |
491 } | 491 } |
492 | 492 |
493 #endif | 493 #endif |
494 | 494 |
495 /////////////////////////////////////////////////////////////////////////////// | 495 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |