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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.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/ImageFrameGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
index b596876ed2bfa0e5b369fe73e4e3c81e6b4c9983..b123d5255e46373166f7725a18f2d54a91e31c5e 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp
@@ -131,7 +131,7 @@ bool ImageFrameGenerator::decodeAndScale(SegmentReader* data,
// This implementation does not support scaling so check the requested size.
SkISize scaledSize = SkISize::Make(info.width(), info.height());
- ASSERT(m_fullSize == scaledSize);
+ DCHECK(m_fullSize == scaledSize);
tkent 2017/04/09 23:17:27 Use DCHECK_EQ if it doesn't cause a compile failur
Hwanseung Lee 2017/04/11 22:24:10 it was cause a compile fail.
// It is okay to allocate ref-counted ExternalMemoryAllocator on the stack,
// because 1) it contains references to memory that will be invalid after
@@ -147,8 +147,8 @@ bool ImageFrameGenerator::decodeAndScale(SegmentReader* data,
// Check to see if the decoder has written directly to the pixel memory
// provided. If not, make a copy.
- ASSERT(bitmap.width() == scaledSize.width());
- ASSERT(bitmap.height() == scaledSize.height());
+ DCHECK_EQ(bitmap.width(), scaledSize.width());
+ DCHECK_EQ(bitmap.height(), scaledSize.height());
SkAutoLockPixels bitmapLock(bitmap);
if (bitmap.getPixels() != pixels)
return bitmap.copyPixelsTo(pixels, rowBytes * info.height(), rowBytes);
@@ -178,20 +178,20 @@ bool ImageFrameGenerator::decodeToYUV(SegmentReader* data,
data, true, ImageDecoder::AlphaPremultiplied, m_decoderColorBehavior);
// getYUVComponentSizes was already called and was successful, so
// ImageDecoder::create must succeed.
- ASSERT(decoder);
+ DCHECK(decoder);
std::unique_ptr<ImagePlanes> imagePlanes =
WTF::makeUnique<ImagePlanes>(planes, rowBytes);
decoder->setImagePlanes(std::move(imagePlanes));
- ASSERT(decoder->canDecodeToYUV());
+ DCHECK(decoder->canDecodeToYUV());
if (decoder->decodeToYUV()) {
setHasAlpha(0, false); // YUV is always opaque
return true;
}
- ASSERT(decoder->failed());
+ DCHECK(decoder->failed());
m_yuvDecodingFailed = true;
return false;
}
@@ -211,7 +211,7 @@ SkBitmap ImageFrameGenerator::tryToResumeDecode(
MutexLocker lock(m_decodeMutex);
const bool resumeDecoding =
ImageDecodingStore::instance().lockDecoder(this, m_fullSize, &decoder);
- ASSERT(!resumeDecoding || decoder);
+ DCHECK(!resumeDecoding || decoder);
SkBitmap fullSizeImage;
bool complete =
@@ -281,12 +281,14 @@ bool ImageFrameGenerator::decode(SegmentReader* data,
ImageDecoder** decoder,
SkBitmap* bitmap,
SkBitmap::Allocator* allocator) {
- ASSERT(m_decodeMutex.locked());
+#if DCHECK_IS_ON()
+ DCHECK(m_decodeMutex.locked());
+#endif
TRACE_EVENT2("blink", "ImageFrameGenerator::decode", "width",
m_fullSize.width(), "height", m_fullSize.height());
// Try to create an ImageDecoder if we are not given one.
- ASSERT(decoder);
+ DCHECK(decoder);
bool newDecoder = false;
bool shouldCallSetData = true;
if (!*decoder) {
@@ -350,7 +352,7 @@ bool ImageFrameGenerator::decode(SegmentReader* data,
SkBitmap fullSizeBitmap = frame->bitmap();
if (!fullSizeBitmap.isNull()) {
- ASSERT(fullSizeBitmap.width() == m_fullSize.width() &&
+ DCHECK(fullSizeBitmap.width() == m_fullSize.width() &&
tkent 2017/04/09 23:17:27 Split this into two DCHECK_EQs.
Hwanseung Lee 2017/04/11 22:24:10 Done.
fullSizeBitmap.height() == m_fullSize.height());
setHasAlpha(index, !fullSizeBitmap.isOpaque());
}

Powered by Google App Engine
This is Rietveld 408576698