Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: src/gpu/GrResourceCache.cpp

Issue 106563002: Delete all invalidated resources with same key (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « no previous file | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698