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

Unified Diff: src/core/SkBitmapHeap.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/core/SkBitmapHeap.h ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapHeap.cpp
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp
index 5b16d21e3013d8eca770de856fb1765c186a511d..c65a704b5ae7b784c2e01b6c6ca850bfb2991356 100644
--- a/src/core/SkBitmapHeap.cpp
+++ b/src/core/SkBitmapHeap.cpp
@@ -65,9 +65,9 @@ bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a,
SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
: INHERITED()
- , fExternalStorage(NULL)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fExternalStorage(nullptr)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(ownerCount)
, fBytesAllocated(0)
@@ -77,8 +77,8 @@ SkBitmapHeap::SkBitmapHeap(int32_t preferredSize, int32_t ownerCount)
SkBitmapHeap::SkBitmapHeap(ExternalStorage* storage, int32_t preferredSize)
: INHERITED()
, fExternalStorage(storage)
- , fMostRecentlyUsed(NULL)
- , fLeastRecentlyUsed(NULL)
+ , fMostRecentlyUsed(nullptr)
+ , fLeastRecentlyUsed(nullptr)
, fPreferredCount(preferredSize)
, fOwnerCount(IGNORE_OWNERS)
, fBytesAllocated(0)
@@ -111,39 +111,39 @@ SkBitmapHeap::~SkBitmapHeap() {
void SkBitmapHeap::removeFromLRU(SkBitmapHeap::LookupEntry* entry) {
if (fMostRecentlyUsed == entry) {
fMostRecentlyUsed = entry->fLessRecentlyUsed;
- if (NULL == fMostRecentlyUsed) {
+ if (nullptr == fMostRecentlyUsed) {
SkASSERT(fLeastRecentlyUsed == entry);
- fLeastRecentlyUsed = NULL;
+ fLeastRecentlyUsed = nullptr;
} else {
- fMostRecentlyUsed->fMoreRecentlyUsed = NULL;
+ fMostRecentlyUsed->fMoreRecentlyUsed = nullptr;
}
} else {
// Remove entry from its prior place, and make sure to cover the hole.
if (fLeastRecentlyUsed == entry) {
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
fLeastRecentlyUsed = entry->fMoreRecentlyUsed;
}
// Since we have already considered the case where entry is the most recently used, it must
// have a more recently used at this point.
- SkASSERT(entry->fMoreRecentlyUsed != NULL);
+ SkASSERT(entry->fMoreRecentlyUsed != nullptr);
entry->fMoreRecentlyUsed->fLessRecentlyUsed = entry->fLessRecentlyUsed;
- if (entry->fLessRecentlyUsed != NULL) {
+ if (entry->fLessRecentlyUsed != nullptr) {
SkASSERT(fLeastRecentlyUsed != entry);
entry->fLessRecentlyUsed->fMoreRecentlyUsed = entry->fMoreRecentlyUsed;
}
}
- entry->fMoreRecentlyUsed = NULL;
+ entry->fMoreRecentlyUsed = nullptr;
}
void SkBitmapHeap::appendToLRU(SkBitmapHeap::LookupEntry* entry) {
- if (fMostRecentlyUsed != NULL) {
- SkASSERT(NULL == fMostRecentlyUsed->fMoreRecentlyUsed);
+ if (fMostRecentlyUsed != nullptr) {
+ SkASSERT(nullptr == fMostRecentlyUsed->fMoreRecentlyUsed);
fMostRecentlyUsed->fMoreRecentlyUsed = entry;
entry->fLessRecentlyUsed = fMostRecentlyUsed;
}
fMostRecentlyUsed = entry;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
fLeastRecentlyUsed = entry;
}
}
@@ -154,13 +154,13 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
SkASSERT(fStorage.count() >= fPreferredCount);
SkBitmapHeap::LookupEntry* iter = fLeastRecentlyUsed;
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
// If the least recently used bitmap has not been unreferenced
// by its owner, then according to our LRU specifications a more
// recently used one can not have used all its references yet either.
- return NULL;
+ return nullptr;
}
if (replacement.getGenerationID() == iter->fGenerationId) {
// Do not replace a bitmap with a new one using the same
@@ -171,7 +171,7 @@ SkBitmapHeap::LookupEntry* SkBitmapHeap::findEntryToReplace(const SkBitmap& repl
return iter;
}
}
- return NULL;
+ return nullptr;
}
size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
@@ -182,7 +182,7 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
size_t origBytesAllocated = fBytesAllocated;
// Purge starting from LRU until a non-evictable bitmap is found or until
// everything is evicted.
- while (iter != NULL) {
+ while (iter != nullptr) {
SkBitmapHeapEntry* heapEntry = fStorage[iter->fStorageSlot];
if (heapEntry->fRefCount > 0) {
break;
@@ -203,15 +203,15 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) {
if (fLeastRecentlyUsed != iter) {
// There was at least one eviction.
fLeastRecentlyUsed = iter;
- if (NULL == fLeastRecentlyUsed) {
+ if (nullptr == fLeastRecentlyUsed) {
// Everything was evicted
- fMostRecentlyUsed = NULL;
+ fMostRecentlyUsed = nullptr;
fBytesAllocated -= (fStorage.count() * sizeof(SkBitmapHeapEntry));
fStorage.deleteAll();
fUnusedSlots.reset();
SkASSERT(0 == fBytesAllocated);
} else {
- fLeastRecentlyUsed->fLessRecentlyUsed = NULL;
+ fLeastRecentlyUsed->fLessRecentlyUsed = nullptr;
}
}
@@ -228,7 +228,7 @@ int SkBitmapHeap::findInLookupTable(const LookupEntry& indexEntry, SkBitmapHeapE
// insert ourselves into the bitmapIndex
index = ~index;
*fLookupTable.insert(index) = new LookupEntry(indexEntry);
- } else if (entry != NULL) {
+ } else if (entry != nullptr) {
// populate the entry if needed
*entry = fStorage[fLookupTable[index]->fStorageSlot];
}
@@ -244,7 +244,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
if (originalBitmap.isImmutable()) {
copiedBitmap = originalBitmap;
// TODO if we have the pixel ref in the heap we could pass it here to avoid a potential deep copy
-// else if (sharedPixelRef != NULL) {
+// else if (sharedPixelRef != nullptr) {
// copiedBitmap = orig;
// copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset());
} else if (originalBitmap.empty()) {
@@ -259,7 +259,7 @@ bool SkBitmapHeap::copyBitmap(const SkBitmap& originalBitmap, SkBitmap& copiedBi
int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
// remove the bitmap index for the deleted entry
SkDEBUGCODE(int count = fLookupTable.count();)
- int index = this->findInLookupTable(*entry, NULL);
+ int index = this->findInLookupTable(*entry, nullptr);
// Verify that findInLookupTable found an existing entry rather than adding
// a new entry to the lookup table.
SkASSERT(count == fLookupTable.count());
@@ -270,7 +270,7 @@ int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) {
}
int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
- SkBitmapHeapEntry* entry = NULL;
+ SkBitmapHeapEntry* entry = nullptr;
int searchIndex = this->findInLookupTable(LookupEntry(originalBitmap), &entry);
if (entry) {
@@ -296,7 +296,7 @@ int32_t SkBitmapHeap::insert(const SkBitmap& originalBitmap) {
if (fPreferredCount != UNLIMITED_SIZE && fStorage.count() >= fPreferredCount) {
// iterate through our LRU cache and try to find an entry to evict
LookupEntry* lookupEntry = this->findEntryToReplace(originalBitmap);
- if (lookupEntry != NULL) {
+ if (lookupEntry != nullptr) {
// we found an entry to evict
entry = fStorage[lookupEntry->fStorageSlot];
// Remove it from the LRU. The new entry will be added to the LRU later.
@@ -383,7 +383,7 @@ void SkBitmapHeap::endAddingOwnersDeferral(bool add) {
for (int i = 0; i < fDeferredEntries.count(); i++) {
SkASSERT(fOwnerCount != IGNORE_OWNERS);
SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]);
- SkASSERT(heapEntry != NULL);
+ SkASSERT(heapEntry != nullptr);
heapEntry->addReferences(fOwnerCount);
}
}
« no previous file with comments | « src/core/SkBitmapHeap.h ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698