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

Side by Side Diff: src/lazy/SkBitmapFactory.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/gpu/GrOvalRenderer.cpp ('k') | src/lazy/SkLruImageCache.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmapFactory.h" 8 #include "SkBitmapFactory.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkData.h" 11 #include "SkData.h"
12 #include "SkImageCache.h" 12 #include "SkImageCache.h"
13 #include "SkImagePriv.h" 13 #include "SkImagePriv.h"
14 #include "SkLazyPixelRef.h" 14 #include "SkLazyPixelRef.h"
15 15
16 SK_DEFINE_INST_COUNT(SkBitmapFactory::CacheSelector)
17
16 SkBitmapFactory::SkBitmapFactory(SkBitmapFactory::DecodeProc proc) 18 SkBitmapFactory::SkBitmapFactory(SkBitmapFactory::DecodeProc proc)
17 : fDecodeProc(proc) 19 : fDecodeProc(proc)
18 , fImageCache(NULL) 20 , fImageCache(NULL)
19 , fCacheSelector(NULL) { 21 , fCacheSelector(NULL) {
20 SkASSERT(fDecodeProc != NULL); 22 SkASSERT(fDecodeProc != NULL);
21 } 23 }
22 24
23 SkBitmapFactory::~SkBitmapFactory() { 25 SkBitmapFactory::~SkBitmapFactory() {
24 SkSafeUnref(fImageCache); 26 SkSafeUnref(fImageCache);
25 SkSafeUnref(fCacheSelector); 27 SkSafeUnref(fCacheSelector);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 SkAutoTUnref<SkLazyPixelRef> lazyRef(SkNEW_ARGS(SkLazyPixelRef, 74 SkAutoTUnref<SkLazyPixelRef> lazyRef(SkNEW_ARGS(SkLazyPixelRef,
73 (data, fDecodeProc, cach e))); 75 (data, fDecodeProc, cach e)));
74 dst->setPixelRef(lazyRef); 76 dst->setPixelRef(lazyRef);
75 return true; 77 return true;
76 } else { 78 } else {
77 dst->allocPixels(); 79 dst->allocPixels();
78 target.fAddr = dst->getPixels(); 80 target.fAddr = dst->getPixels();
79 return fDecodeProc(data->data(), data->size(), &info, &target); 81 return fDecodeProc(data->data(), data->size(), &info, &target);
80 } 82 }
81 } 83 }
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/lazy/SkLruImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698