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

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

Issue 502543002: Fix leak of GrResourceCacheEntry (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | src/gpu/GrResourceCache.h » ('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 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 10 #include "GrContext.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // will never be reused and would be just wasting time in the cache 541 // will never be reused and would be just wasting time in the cache
542 fResourceCache->makeNonExclusive(texture->getCacheEntry()); 542 fResourceCache->makeNonExclusive(texture->getCacheEntry());
543 fResourceCache->deleteResource(texture->getCacheEntry()); 543 fResourceCache->deleteResource(texture->getCacheEntry());
544 } 544 }
545 } 545 }
546 546
547 void GrContext::unlockScratchTexture(GrTexture* texture) { 547 void GrContext::unlockScratchTexture(GrTexture* texture) {
548 if (texture->wasDestroyed()) { 548 if (texture->wasDestroyed()) {
549 if (texture->getCacheEntry()->key().isScratch()) { 549 if (texture->getCacheEntry()->key().isScratch()) {
550 // This texture was detached from the cache but the cache still had a ref to it but 550 // This texture was detached from the cache but the cache still had a ref to it but
551 // not a pointer to it. 551 // not a pointer to it. This will unref the texture and delete its r esource cache
552 texture->unref(); 552 // entry.
553 delete texture->getCacheEntry();
553 } 554 }
554 return; 555 return;
555 } 556 }
556 557
557 ASSERT_OWNED_RESOURCE(texture); 558 ASSERT_OWNED_RESOURCE(texture);
558 SkASSERT(NULL != texture->getCacheEntry()); 559 SkASSERT(NULL != texture->getCacheEntry());
559 560
560 // If this is a scratch texture we detached it from the cache 561 // If this is a scratch texture we detached it from the cache
561 // while it was locked (to avoid two callers simultaneously getting 562 // while it was locked (to avoid two callers simultaneously getting
562 // the same texture). 563 // the same texture).
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 fDrawBuffer->removeGpuTraceMarker(marker); 1946 fDrawBuffer->removeGpuTraceMarker(marker);
1946 } 1947 }
1947 } 1948 }
1948 1949
1949 /////////////////////////////////////////////////////////////////////////////// 1950 ///////////////////////////////////////////////////////////////////////////////
1950 #if GR_CACHE_STATS 1951 #if GR_CACHE_STATS
1951 void GrContext::printCacheStats() const { 1952 void GrContext::printCacheStats() const {
1952 fResourceCache->printStats(); 1953 fResourceCache->printStats();
1953 } 1954 }
1954 #endif 1955 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698