diff options
author | halcanary <halcanary@google.com> | 2015-08-27 07:41:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 07:41:16 -0700 |
commit | 96fcdcc219d2a0d3579719b84b28bede76efba64 (patch) | |
tree | 0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /src/lazy | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'src/lazy')
-rw-r--r-- | src/lazy/SkCachingPixelRef.cpp | 10 | ||||
-rw-r--r-- | src/lazy/SkDiscardableMemoryPool.cpp | 28 | ||||
-rw-r--r-- | src/lazy/SkDiscardableMemoryPool.h | 2 | ||||
-rw-r--r-- | src/lazy/SkDiscardablePixelRef.cpp | 22 |
4 files changed, 31 insertions, 31 deletions
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp index f65e5454a7..692e4ea3d6 100644 --- a/src/lazy/SkCachingPixelRef.cpp +++ b/src/lazy/SkCachingPixelRef.cpp @@ -11,8 +11,8 @@ bool SkCachingPixelRef::Install(SkImageGenerator* generator, SkBitmap* dst) { - SkASSERT(dst != NULL); - if (NULL == generator) { + SkASSERT(dst != nullptr); + if (nullptr == generator) { return false; } const SkImageInfo info = generator->getInfo(); @@ -32,7 +32,7 @@ SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info, , fImageGenerator(generator) , fErrorInDecoding(false) , fRowBytes(rowBytes) { - SkASSERT(fImageGenerator != NULL); + SkASSERT(fImageGenerator != nullptr); } SkCachingPixelRef::~SkCachingPixelRef() { delete fImageGenerator; @@ -62,9 +62,9 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) { // Now bitmap should contain a concrete PixelRef of the decoded image. void* pixels = fLockedBitmap.getPixels(); - SkASSERT(pixels != NULL); + SkASSERT(pixels != nullptr); rec->fPixels = pixels; - rec->fColorTable = NULL; + rec->fColorTable = nullptr; rec->fRowBytes = fLockedBitmap.rowBytes(); return true; } diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp index 898d7661fb..17b8c23d95 100644 --- a/src/lazy/SkDiscardableMemoryPool.cpp +++ b/src/lazy/SkDiscardableMemoryPool.cpp @@ -29,7 +29,7 @@ public: /** * Without mutex, will be not be thread safe. */ - DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = NULL); + DiscardableMemoryPool(size_t budget, SkBaseMutex* mutex = nullptr); virtual ~DiscardableMemoryPool(); SkDiscardableMemory* create(size_t bytes) override; @@ -99,8 +99,8 @@ PoolDiscardableMemory::PoolDiscardableMemory(DiscardableMemoryPool* pool, , fLocked(true) , fPointer(pointer) , fBytes(bytes) { - SkASSERT(fPool != NULL); - SkASSERT(fPointer != NULL); + SkASSERT(fPool != nullptr); + SkASSERT(fPointer != nullptr); SkASSERT(fBytes > 0); fPool->ref(); } @@ -146,7 +146,7 @@ DiscardableMemoryPool::~DiscardableMemoryPool() { } void DiscardableMemoryPool::dumpDownTo(size_t budget) { - if (fMutex != NULL) { + if (fMutex != nullptr) { fMutex->assertHeld(); } if (fUsed <= budget) { @@ -158,9 +158,9 @@ void DiscardableMemoryPool::dumpDownTo(size_t budget) { while ((fUsed > budget) && (cur)) { if (!cur->fLocked) { PoolDiscardableMemory* dm = cur; - SkASSERT(dm->fPointer != NULL); + SkASSERT(dm->fPointer != nullptr); sk_free(dm->fPointer); - dm->fPointer = NULL; + dm->fPointer = nullptr; SkASSERT(fUsed >= dm->fBytes); fUsed -= dm->fBytes; cur = iter.prev(); @@ -175,8 +175,8 @@ void DiscardableMemoryPool::dumpDownTo(size_t budget) { SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) { void* addr = sk_malloc_flags(bytes, 0); - if (NULL == addr) { - return NULL; + if (nullptr == addr) { + return nullptr; } PoolDiscardableMemory* dm = new PoolDiscardableMemory(this, addr, bytes); SkAutoMutexAcquire autoMutexAcquire(fMutex); @@ -189,9 +189,9 @@ SkDiscardableMemory* DiscardableMemoryPool::create(size_t bytes) { void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) { SkAutoMutexAcquire autoMutexAcquire(fMutex); // This is called by dm's destructor. - if (dm->fPointer != NULL) { + if (dm->fPointer != nullptr) { sk_free(dm->fPointer); - dm->fPointer = NULL; + dm->fPointer = nullptr; SkASSERT(fUsed >= dm->fBytes); fUsed -= dm->fBytes; fList.remove(dm); @@ -201,8 +201,8 @@ void DiscardableMemoryPool::free(PoolDiscardableMemory* dm) { } bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) { - SkASSERT(dm != NULL); - if (NULL == dm->fPointer) { + SkASSERT(dm != nullptr); + if (nullptr == dm->fPointer) { #if SK_LAZY_CACHE_STATS SkAutoMutexAcquire autoMutexAcquire(fMutex); ++fCacheMisses; @@ -210,7 +210,7 @@ bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) { return false; } SkAutoMutexAcquire autoMutexAcquire(fMutex); - if (NULL == dm->fPointer) { + if (nullptr == dm->fPointer) { // May have been purged while waiting for lock. #if SK_LAZY_CACHE_STATS ++fCacheMisses; @@ -227,7 +227,7 @@ bool DiscardableMemoryPool::lock(PoolDiscardableMemory* dm) { } void DiscardableMemoryPool::unlock(PoolDiscardableMemory* dm) { - SkASSERT(dm != NULL); + SkASSERT(dm != nullptr); SkAutoMutexAcquire autoMutexAcquire(fMutex); dm->fLocked = false; this->dumpDownTo(fBudget); diff --git a/src/lazy/SkDiscardableMemoryPool.h b/src/lazy/SkDiscardableMemoryPool.h index 33c176d3f2..92ba48bcb4 100644 --- a/src/lazy/SkDiscardableMemoryPool.h +++ b/src/lazy/SkDiscardableMemoryPool.h @@ -53,7 +53,7 @@ public: * Without mutex, will be not be thread safe. */ static SkDiscardableMemoryPool* Create( - size_t size, SkBaseMutex* mutex = NULL); + size_t size, SkBaseMutex* mutex = nullptr); }; /** diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp index 01bfd83eee..9ac9819e92 100644 --- a/src/lazy/SkDiscardablePixelRef.cpp +++ b/src/lazy/SkDiscardablePixelRef.cpp @@ -17,10 +17,10 @@ SkDiscardablePixelRef::SkDiscardablePixelRef(const SkImageInfo& info, , fGenerator(generator) , fDMFactory(fact) , fRowBytes(rowBytes) - , fDiscardableMemory(NULL) + , fDiscardableMemory(nullptr) , fDiscardableMemoryIsLocked(false) { - SkASSERT(fGenerator != NULL); + SkASSERT(fGenerator != nullptr); SkASSERT(fRowBytes > 0); // The SkImageGenerator contract requires fGenerator to always // decode the same image on each call to getPixels(). @@ -39,7 +39,7 @@ SkDiscardablePixelRef::~SkDiscardablePixelRef() { } bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { - if (fDiscardableMemory != NULL) { + if (fDiscardableMemory != nullptr) { if (fDiscardableMemory->lock()) { fDiscardableMemoryIsLocked = true; rec->fPixels = fDiscardableMemory->data(); @@ -48,20 +48,20 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { return true; } delete fDiscardableMemory; - fDiscardableMemory = NULL; + fDiscardableMemory = nullptr; fDiscardableMemoryIsLocked = false; } const size_t size = this->info().getSafeSize(fRowBytes); - if (fDMFactory != NULL) { + if (fDMFactory != nullptr) { fDiscardableMemory = fDMFactory->create(size); fDiscardableMemoryIsLocked = true; } else { fDiscardableMemory = SkDiscardableMemory::Create(size); fDiscardableMemoryIsLocked = true; } - if (NULL == fDiscardableMemory) { + if (nullptr == fDiscardableMemory) { fDiscardableMemoryIsLocked = false; return false; // Memory allocation failed. } @@ -75,7 +75,7 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { fDiscardableMemory->unlock(); fDiscardableMemoryIsLocked = false; delete fDiscardableMemory; - fDiscardableMemory = NULL; + fDiscardableMemory = nullptr; return false; } @@ -87,7 +87,7 @@ bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { if (colorCount > 0) { fCTable.reset(new SkColorTable(colors, colorCount)); } else { - fCTable.reset(NULL); + fCTable.reset(nullptr); } rec->fPixels = pixels; @@ -104,7 +104,7 @@ void SkDiscardablePixelRef::onUnlockPixels() { bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, const SkIRect* subset, SkBitmap* dst, SkDiscardableMemory::Factory* factory) { SkAutoTDelete<SkImageGenerator> autoGenerator(generator); - if (NULL == autoGenerator.get()) { + if (nullptr == autoGenerator.get()) { return false; } @@ -145,10 +145,10 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, const SkIRect* su // These are the public API bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) { - return SkInstallDiscardablePixelRef(generator, NULL, dst, NULL); + return SkInstallDiscardablePixelRef(generator, nullptr, dst, nullptr); } bool SkInstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) { SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded); - return generator ? SkInstallDiscardablePixelRef(generator, NULL, dst, NULL) : false; + return generator ? SkInstallDiscardablePixelRef(generator, nullptr, dst, nullptr) : false; } |