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

Side by Side Diff: src/lazy/SkPurgeableImageCache.cpp

Issue 18461007: Fix two leaks & improve leak tracking (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | « src/lazy/SkLruImageCache.cpp ('k') | no next file » | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkThread.h" 8 #include "SkThread.h"
9 #include "SkPurgeableImageCache.h" 9 #include "SkPurgeableImageCache.h"
10 #include "SkPurgeableMemoryBlock.h" 10 #include "SkPurgeableMemoryBlock.h"
11 11
12 #ifdef SK_DEBUG 12 #ifdef SK_DEBUG
13 #include "SkTSearch.h" 13 #include "SkTSearch.h"
14 #endif 14 #endif
15 15
16 SK_DEFINE_INST_COUNT(SkPurgeableImageCache)
16 SK_DECLARE_STATIC_MUTEX(gPurgeableImageMutex); 17 SK_DECLARE_STATIC_MUTEX(gPurgeableImageMutex);
17 18
18 SkImageCache* SkPurgeableImageCache::Create() { 19 SkImageCache* SkPurgeableImageCache::Create() {
19 if (!SkPurgeableMemoryBlock::IsSupported()) { 20 if (!SkPurgeableMemoryBlock::IsSupported()) {
20 return NULL; 21 return NULL;
21 } 22 }
22 SkAutoMutexAcquire ac(&gPurgeableImageMutex); 23 SkAutoMutexAcquire ac(&gPurgeableImageMutex);
23 static SkPurgeableImageCache gCache; 24 static SkPurgeableImageCache gCache;
24 gCache.ref(); 25 gCache.ref();
25 return &gCache; 26 return &gCache;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void SkPurgeableImageCache::removeRec(intptr_t ID) { 151 void SkPurgeableImageCache::removeRec(intptr_t ID) {
151 #ifdef SK_DEBUG 152 #ifdef SK_DEBUG
152 int index = this->findRec(ID); 153 int index = this->findRec(ID);
153 SkASSERT(index >= 0); 154 SkASSERT(index >= 0);
154 fRecs.remove(index); 155 fRecs.remove(index);
155 #endif 156 #endif
156 SkPurgeableMemoryBlock* block = reinterpret_cast<SkPurgeableMemoryBlock*>(ID ); 157 SkPurgeableMemoryBlock* block = reinterpret_cast<SkPurgeableMemoryBlock*>(ID );
157 SkASSERT(!block->isPinned()); 158 SkASSERT(!block->isPinned());
158 SkDELETE(block); 159 SkDELETE(block);
159 } 160 }
OLDNEW
« no previous file with comments | « src/lazy/SkLruImageCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698