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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp

Issue 2807923002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics (Closed)
Patch Set: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics Created 3 years, 8 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
Index: third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
index d57f53ff8003fdcb46d4398a9a226dec121a1ef8..702e6571221b272a1e3de5d95ca92d2c634709fa 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -45,9 +45,9 @@ ImageDecodingStore::ImageDecodingStore()
ImageDecodingStore::~ImageDecodingStore() {
#if DCHECK_IS_ON()
setCacheLimitInBytes(0);
- ASSERT(!m_decoderCacheMap.size());
- ASSERT(!m_orderedCacheList.size());
- ASSERT(!m_decoderCacheKeyMap.size());
+ DCHECK(!m_decoderCacheMap.size());
+ DCHECK(!m_orderedCacheList.size());
+ DCHECK(!m_decoderCacheKeyMap.size());
#endif
}
@@ -60,7 +60,7 @@ ImageDecodingStore& ImageDecodingStore::instance() {
bool ImageDecodingStore::lockDecoder(const ImageFrameGenerator* generator,
const SkISize& scaledSize,
ImageDecoder** decoder) {
- ASSERT(decoder);
+ DCHECK(decoder);
MutexLocker lock(m_mutex);
DecoderCacheMap::iterator iter = m_decoderCacheMap.find(
@@ -71,7 +71,7 @@ bool ImageDecodingStore::lockDecoder(const ImageFrameGenerator* generator,
DecoderCacheEntry* cacheEntry = iter->value.get();
// There can only be one user of a decoder at a time.
- ASSERT(!cacheEntry->useCount());
+ DCHECK(!cacheEntry->useCount());
cacheEntry->incrementUseCount();
*decoder = cacheEntry->cachedDecoder();
return true;
@@ -101,7 +101,7 @@ void ImageDecodingStore::insertDecoder(const ImageFrameGenerator* generator,
DecoderCacheEntry::create(generator, std::move(decoder));
MutexLocker lock(m_mutex);
- ASSERT(!m_decoderCacheMap.contains(newCacheEntry->cacheKey()));
+ DCHECK(!m_decoderCacheMap.contains(newCacheEntry->cacheKey()));
insertCacheInternal(std::move(newCacheEntry), &m_decoderCacheMap,
&m_decoderCacheKeyMap);
}
@@ -116,7 +116,7 @@ void ImageDecodingStore::removeDecoder(const ImageFrameGenerator* generator,
SECURITY_DCHECK(iter != m_decoderCacheMap.end());
CacheEntry* cacheEntry = iter->value.get();
- ASSERT(cacheEntry->useCount());
+ DCHECK(cacheEntry->useCount());
cacheEntry->decrementUseCount();
// Delete only one decoder cache entry. Ownership of the cache entry
@@ -241,12 +241,12 @@ void ImageDecodingStore::removeFromCacheInternal(
V* identifierMap,
Vector<std::unique_ptr<CacheEntry>>* deletionList) {
const size_t cacheEntryBytes = cacheEntry->memoryUsageInBytes();
- ASSERT(m_heapMemoryUsageInBytes >= cacheEntryBytes);
+ DCHECK_GE(m_heapMemoryUsageInBytes, cacheEntryBytes);
m_heapMemoryUsageInBytes -= cacheEntryBytes;
// Remove entry from identifier map.
typename V::iterator iter = identifierMap->find(cacheEntry->generator());
- ASSERT(iter != identifierMap->end());
+ DCHECK_NE(iter, identifierMap->end());
iter->value.erase(cacheEntry->cacheKey());
if (!iter->value.size())
identifierMap->erase(iter);
@@ -269,7 +269,7 @@ void ImageDecodingStore::removeFromCacheInternal(
&m_decoderCacheMap, &m_decoderCacheKeyMap,
deletionList);
} else {
- ASSERT(false);
+ DCHECK(false);
}
}
@@ -289,9 +289,9 @@ void ImageDecodingStore::removeCacheIndexedByGeneratorInternal(
// For each cache identifier find the corresponding CacheEntry and remove it.
for (size_t i = 0; i < cacheIdentifierList.size(); ++i) {
- ASSERT(cacheMap->contains(cacheIdentifierList[i]));
+ DCHECK(cacheMap->contains(cacheIdentifierList[i]));
const auto& cacheEntry = cacheMap->at(cacheIdentifierList[i]);
- ASSERT(!cacheEntry->useCount());
+ DCHECK(!cacheEntry->useCount());
removeFromCacheInternal(cacheEntry, cacheMap, identifierMap, deletionList);
}
}

Powered by Google App Engine
This is Rietveld 408576698