Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 898d766..17b8c23 100644
--- a/src/lazy/SkDiscardableMemoryPool.cpp
+++ b/src/lazy/SkDiscardableMemoryPool.cpp
@@ -29,7 +29,7 @@
/**
* 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 @@
, 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 @@
}
void DiscardableMemoryPool::dumpDownTo(size_t budget) {
- if (fMutex != NULL) {
+ if (fMutex != nullptr) {
fMutex->assertHeld();
}
if (fUsed <= budget) {
@@ -158,9 +158,9 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
}
void DiscardableMemoryPool::unlock(PoolDiscardableMemory* dm) {
- SkASSERT(dm != NULL);
+ SkASSERT(dm != nullptr);
SkAutoMutexAcquire autoMutexAcquire(fMutex);
dm->fLocked = false;
this->dumpDownTo(fBudget);