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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 fCache.remove(entry->key(), entry); | 260 fCache.remove(entry->key(), entry); |
261 | 261 |
262 #ifdef SK_DEBUG | 262 #ifdef SK_DEBUG |
263 fExclusiveList.addToHead(entry); | 263 fExclusiveList.addToHead(entry); |
264 #endif | 264 #endif |
265 } | 265 } |
266 | 266 |
267 void GrResourceCache::removeInvalidResource(GrResourceCacheEntry* entry) { | 267 void GrResourceCache::removeInvalidResource(GrResourceCacheEntry* entry) { |
268 // If the resource went invalid while it was detached then purge it | 268 // If the resource went invalid while it was detached then purge it |
269 // This can happen when a 3D context was lost, | 269 // This can happen when a 3D context was lost, |
270 // the client called GrContext::abandonContext() to notify Gr, | 270 // the client called GrContext::contextDestroyed() to notify Gr, |
271 // and then later an SkGpuDevice's destructor releases its backing | 271 // and then later an SkGpuDevice's destructor releases its backing |
272 // texture (which was invalidated at contextDestroyed time). | 272 // texture (which was invalidated at contextDestroyed time). |
273 // TODO: Safely delete the GrResourceCacheEntry as well. | 273 // TODO: Safely delete the GrResourceCacheEntry as well. |
274 fClientDetachedCount -= 1; | 274 fClientDetachedCount -= 1; |
275 fEntryCount -= 1; | 275 fEntryCount -= 1; |
276 fClientDetachedBytes -= entry->fCachedSize; | 276 fClientDetachedBytes -= entry->fCachedSize; |
277 fEntryBytes -= entry->fCachedSize; | 277 fEntryBytes -= entry->fCachedSize; |
278 entry->fCachedSize = 0; | 278 entry->fCachedSize = 0; |
279 } | 279 } |
280 | 280 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 fEntryBytes, fHighWaterEntryBytes); | 536 fEntryBytes, fHighWaterEntryBytes); |
537 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", | 537 SkDebugf("\t\tDetached Entry Count: current %d high %d\n", |
538 fClientDetachedCount, fHighWaterClientDetachedCount); | 538 fClientDetachedCount, fHighWaterClientDetachedCount); |
539 SkDebugf("\t\tDetached Bytes: current %d high %d\n", | 539 SkDebugf("\t\tDetached Bytes: current %d high %d\n", |
540 fClientDetachedBytes, fHighWaterClientDetachedBytes); | 540 fClientDetachedBytes, fHighWaterClientDetachedBytes); |
541 } | 541 } |
542 | 542 |
543 #endif | 543 #endif |
544 | 544 |
545 /////////////////////////////////////////////////////////////////////////////// | 545 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |