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

Unified Diff: src/core/SkResourceCache.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkResourceCache.cpp
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 922fc7ee0a5d9ca186b7ce80d7d473b6cdef355c..911a09071eee582a979d7c8ef722aac34e204552 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -105,9 +105,7 @@ SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in
fFirstTime = true;
}
-SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() {
- SkDELETE(fDM);
-}
+SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() { delete fDM; }
bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
if (fFirstTime) {
@@ -176,8 +174,7 @@ bool SkResourceCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap, SkColo
}
SkImageInfo info = bitmap->info();
- bitmap->setPixelRef(SkNEW_ARGS(SkOneShotDiscardablePixelRef,
- (info, dm, bitmap->rowBytes())))->unref();
+ bitmap->setPixelRef(new SkOneShotDiscardablePixelRef(info, dm, bitmap->rowBytes()))->unref();
bitmap->lockPixels();
return bitmap->readyToDraw();
}
@@ -186,7 +183,7 @@ SkResourceCache::SkResourceCache(DiscardableFactory factory) {
this->init();
fDiscardableFactory = factory;
- fAllocator = SkNEW_ARGS(SkResourceCacheDiscardableAllocator, (factory));
+ fAllocator = new SkResourceCacheDiscardableAllocator(factory);
}
SkResourceCache::SkResourceCache(size_t byteLimit) {
@@ -200,7 +197,7 @@ SkResourceCache::~SkResourceCache() {
Rec* rec = fHead;
while (rec) {
Rec* next = rec->fNext;
- SkDELETE(rec);
+ delete rec;
rec = next;
}
delete fHash;
@@ -243,7 +240,7 @@ void SkResourceCache::add(Rec* rec) {
// See if we already have this key (racy inserts, etc.)
Rec* existing = fHash->find(rec->getKey());
if (existing) {
- SkDELETE(rec);
+ delete rec;
return;
}
@@ -280,7 +277,7 @@ void SkResourceCache::remove(Rec* rec) {
bytesStr.c_str(), rec, rec->getHash(), totalStr.c_str(), fCount);
}
- SkDELETE(rec);
+ delete rec;
}
void SkResourceCache::purgeAsNeeded(bool forcePurge) {
@@ -374,9 +371,9 @@ SkCachedData* SkResourceCache::newCachedData(size_t bytes) {
if (fDiscardableFactory) {
SkDiscardableMemory* dm = fDiscardableFactory(bytes);
- return dm ? SkNEW_ARGS(SkCachedData, (bytes, dm)) : NULL;
+ return dm ? new SkCachedData(bytes, dm) : NULL;
} else {
- return SkNEW_ARGS(SkCachedData, (sk_malloc_throw(bytes), bytes));
+ return new SkCachedData(sk_malloc_throw(bytes), bytes);
}
}
@@ -537,7 +534,7 @@ static void cleanup_gResourceCache() {
// makes this unsafe to delete when the main process atexit()s.
// SkLazyPtr does the same sort of thing.
#if SK_DEVELOPER
- SkDELETE(gResourceCache);
+ delete gResourceCache;
#endif
}
@@ -547,9 +544,9 @@ static SkResourceCache* get_cache() {
gMutex.assertHeld();
if (NULL == gResourceCache) {
#ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE
- gResourceCache = SkNEW_ARGS(SkResourceCache, (SkDiscardableMemory::Create));
+ gResourceCache = new SkResourceCache(SkDiscardableMemory::Create);
#else
- gResourceCache = SkNEW_ARGS(SkResourceCache, (SK_DEFAULT_IMAGE_CACHE_LIMIT));
+ gResourceCache = new SkResourceCache(SK_DEFAULT_IMAGE_CACHE_LIMIT);
#endif
atexit(cleanup_gResourceCache);
}
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698