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

Unified Diff: src/lazy/SkDiscardableMemoryPool.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 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/lazy/SkDiscardableMemoryPool.h ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardableMemoryPool.cpp
diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp
index 898d7661fbad230d8109a3c2f20376220f5a5d42..17b8c23d950503ac360954fcae2824c47920371d 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);
« no previous file with comments | « src/lazy/SkDiscardableMemoryPool.h ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698