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

Unified Diff: third_party/WebKit/Source/core/html/ImageData.cpp

Issue 2258033002: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. Created 4 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
Index: third_party/WebKit/Source/core/html/ImageData.cpp
diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp
index 22489bacc904c22a136b989daca20434acf24783..1788255147b0969d8c505ec737980c5b67b601f8 100644
--- a/third_party/WebKit/Source/core/html/ImageData.cpp
+++ b/third_party/WebKit/Source/core/html/ImageData.cpp
@@ -100,7 +100,7 @@ bool ImageData::validateConstructorArguments(DOMUint8ClampedArray* data, unsigne
exceptionState.throwDOMException(IndexSizeError, "The source width is zero or not a number.");
return false;
}
- ASSERT(data);
+ DCHECK(data);
unsigned length = data->length();
if (!length) {
exceptionState.throwDOMException(IndexSizeError, "The input data has a zero byte length.");
@@ -123,10 +123,11 @@ ImageData* ImageData::create(DOMUint8ClampedArray* data, unsigned width, Excepti
{
unsigned lengthInPixels = 0;
if (!validateConstructorArguments(data, width, lengthInPixels, exceptionState)) {
- ASSERT(exceptionState.hadException());
+ DCHECK(exceptionState.hadException());
return nullptr;
}
- ASSERT(lengthInPixels && width);
+ DCHECK_GT(lengthInPixels, 0u);
+ DCHECK_GT(width, 0u);
unsigned height = lengthInPixels / width;
return new ImageData(IntSize(width, height), data);
}
@@ -135,10 +136,11 @@ ImageData* ImageData::create(DOMUint8ClampedArray* data, unsigned width, unsigne
{
unsigned lengthInPixels = 0;
if (!validateConstructorArguments(data, width, lengthInPixels, exceptionState)) {
- ASSERT(exceptionState.hadException());
+ DCHECK(exceptionState.hadException());
return nullptr;
}
- ASSERT(lengthInPixels && width);
+ DCHECK_GT(lengthInPixels, 0u);
+ DCHECK_GT(width, 0u);
if (height != lengthInPixels / width) {
exceptionState.throwDOMException(IndexSizeError, "The input data byte length is not equal to (4 * width * height).");
return nullptr;
@@ -179,8 +181,9 @@ ImageData::ImageData(const IntSize& size, DOMUint8ClampedArray* byteArray)
: m_size(size)
, m_data(byteArray)
{
- ASSERT(size.width() >= 0 && size.height() >= 0);
- ASSERT_WITH_SECURITY_IMPLICATION(static_cast<unsigned>(size.width() * size.height() * 4) <= m_data->length());
+ DCHECK_GE(size.width(), 0);
+ DCHECK_GE(size.height(), 0);
+ SECURITY_CHECK(static_cast<unsigned>(size.width() * size.height() * 4) <= m_data->length());
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLViewSourceDocument.cpp ('k') | third_party/WebKit/Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698