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

Unified Diff: third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp

Issue 2811453002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/text (Closed)
Patch Set: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/text 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/text/TextBreakIteratorICU.cpp
diff --git a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
index a5d3e02124bb6d197e6537d63b7c286e5db9284c..e3239456b52d41ef84ad9f5c1ba15e6669b9105f 100644
--- a/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
+++ b/third_party/WebKit/Source/platform/text/TextBreakIteratorICU.cpp
@@ -83,7 +83,7 @@ class LineBreakIteratorPool final {
}
}
- ASSERT(!m_vendedIterators.contains(iterator));
+ DCHECK(!m_vendedIterators.contains(iterator));
m_vendedIterators.set(iterator, locale);
return iterator;
}
@@ -176,7 +176,7 @@ static UText* textClone(UText* destination,
textFixPointer(source, destination, destination->context);
textFixPointer(source, destination, destination->p);
textFixPointer(source, destination, destination->q);
- ASSERT(!destination->r);
+ DCHECK(!destination->r);
const void* chunkContents =
static_cast<const void*>(destination->chunkContents);
textFixPointer(source, destination, chunkContents);
@@ -192,7 +192,7 @@ static int32_t textExtract(UText*,
UErrorCode* errorCode) {
// In the present context, this text provider is used only with ICU functions
// that do not perform an extract operation.
- ASSERT_NOT_REACHED();
+ NOTREACHED();
*errorCode = U_UNSUPPORTED_ERROR;
return 0;
}
@@ -221,15 +221,15 @@ static void textLatin1MoveInPrimaryContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(text->chunkContents == text->pExtra);
+ DCHECK_EQ(text->chunkContents, text->pExtra);
if (forward) {
- ASSERT(nativeIndex >= text->b && nativeIndex < nativeLength);
+ DCHECK(nativeIndex >= text->b && nativeIndex < nativeLength);
tkent 2017/04/09 23:07:02 Split this into two DCHECKs.
Hwanseung Lee 2017/04/11 03:29:38 Done.
text->chunkNativeStart = nativeIndex;
text->chunkNativeLimit = nativeIndex + text->extraSize / sizeof(UChar);
if (text->chunkNativeLimit > nativeLength)
text->chunkNativeLimit = nativeLength;
} else {
- ASSERT(nativeIndex > text->b && nativeIndex <= nativeLength);
+ DCHECK(nativeIndex > text->b && nativeIndex <= nativeLength);
tkent 2017/04/09 23:07:02 Split this into two DCHECKs
Hwanseung Lee 2017/04/11 03:29:38 Done.
text->chunkNativeLimit = nativeIndex;
text->chunkNativeStart = nativeIndex - text->extraSize / sizeof(UChar);
if (text->chunkNativeStart < text->b)
@@ -238,7 +238,7 @@ static void textLatin1MoveInPrimaryContext(UText* text,
int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
// Ensure chunk length is well defined if computed length exceeds int32_t
// range.
- ASSERT(length <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(length, std::numeric_limits<int32_t>::max());
text->chunkLength = length <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(length)
: 0;
@@ -254,7 +254,7 @@ static void textLatin1SwitchToPrimaryContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(!text->chunkContents || text->chunkContents == text->q);
+ DCHECK(!text->chunkContents || text->chunkContents == text->q);
text->chunkContents = static_cast<const UChar*>(text->pExtra);
textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
}
@@ -263,8 +263,8 @@ static void textLatin1MoveInPriorContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(text->chunkContents == text->q);
- ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
+ DCHECK_EQ(text->chunkContents, text->q);
+ DCHECK(forward ? nativeIndex < text->b : nativeIndex <= text->b);
DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
text->chunkNativeStart = 0;
@@ -274,7 +274,7 @@ static void textLatin1MoveInPriorContext(UText* text,
int64_t offset = nativeIndex - text->chunkNativeStart;
// Ensure chunk offset is well defined if computed offset exceeds int32_t
// range or chunk length.
- ASSERT(offset <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(offset, std::numeric_limits<int32_t>::max());
text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(offset)
: 0,
@@ -285,7 +285,7 @@ static void textLatin1SwitchToPriorContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(!text->chunkContents || text->chunkContents == text->pExtra);
+ DCHECK(!text->chunkContents || text->chunkContents == text->pExtra);
text->chunkContents = static_cast<const UChar*>(text->q);
textLatin1MoveInPriorContext(text, nativeIndex, nativeLength, forward);
}
@@ -301,7 +301,7 @@ static inline bool textInChunkOrOutOfRange(UText* text,
int64_t offset = nativeIndex - text->chunkNativeStart;
// Ensure chunk offset is well formed if computed offset exceeds int32_t
// range.
- ASSERT(offset <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(offset, std::numeric_limits<int32_t>::max());
text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(offset)
: 0;
@@ -319,7 +319,7 @@ static inline bool textInChunkOrOutOfRange(UText* text,
int64_t offset = nativeIndex - text->chunkNativeStart;
// Ensure chunk offset is well formed if computed offset exceeds int32_t
// range.
- ASSERT(offset <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(offset, std::numeric_limits<int32_t>::max());
text->chunkOffset = offset <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(offset)
: 0;
@@ -346,7 +346,7 @@ static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward) {
nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
TextContext currentContext = textLatin1GetCurrentContext(text);
TextContext newContext = textGetContext(text, nativeIndex, forward);
- ASSERT(newContext != NoContext);
+ DCHECK_NE(newContext, NoContext);
if (newContext == currentContext) {
if (currentContext == PrimaryContext) {
textLatin1MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
@@ -356,7 +356,7 @@ static UBool textLatin1Access(UText* text, int64_t nativeIndex, UBool forward) {
} else if (newContext == PrimaryContext) {
textLatin1SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
} else {
- ASSERT(newContext == PriorContext);
+ DCHECK_EQ(newContext, PriorContext);
textLatin1SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
}
return TRUE;
@@ -400,7 +400,7 @@ static UText* textOpenLatin1(UTextWithBuffer* utWithBuffer,
UText* text =
utext_setup(&utWithBuffer->text, sizeof(utWithBuffer->buffer), status);
if (U_FAILURE(*status)) {
- ASSERT(!text);
+ DCHECK(!text);
return 0;
}
textInit(text, &textLatin1Funcs, string, length, priorContext,
@@ -418,7 +418,7 @@ static void textUTF16MoveInPrimaryContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(text->chunkContents == text->p);
+ DCHECK_EQ(text->chunkContents, text->p);
DCHECK(forward ? nativeIndex >= text->b : nativeIndex > text->b);
DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
text->chunkNativeStart = text->b;
@@ -426,7 +426,7 @@ static void textUTF16MoveInPrimaryContext(UText* text,
int64_t length = text->chunkNativeLimit - text->chunkNativeStart;
// Ensure chunk length is well defined if computed length exceeds int32_t
// range.
- ASSERT(length <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(length, std::numeric_limits<int32_t>::max());
text->chunkLength = length <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(length)
: 0;
@@ -434,7 +434,7 @@ static void textUTF16MoveInPrimaryContext(UText* text,
int64_t offset = nativeIndex - text->chunkNativeStart;
// Ensure chunk offset is well defined if computed offset exceeds int32_t
// range or chunk length.
- ASSERT(offset <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(offset, std::numeric_limits<int32_t>::max());
text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(offset)
: 0,
@@ -445,7 +445,7 @@ static void textUTF16SwitchToPrimaryContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(!text->chunkContents || text->chunkContents == text->q);
+ DCHECK(!text->chunkContents || text->chunkContents == text->q);
text->chunkContents = static_cast<const UChar*>(text->p);
textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
}
@@ -454,8 +454,8 @@ static void textUTF16MoveInPriorContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(text->chunkContents == text->q);
- ASSERT(forward ? nativeIndex < text->b : nativeIndex <= text->b);
+ DCHECK_EQ(text->chunkContents, text->q);
+ DCHECK(forward ? nativeIndex < text->b : nativeIndex <= text->b);
DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
DCHECK(forward ? nativeIndex < nativeLength : nativeIndex <= nativeLength);
text->chunkNativeStart = 0;
@@ -465,7 +465,7 @@ static void textUTF16MoveInPriorContext(UText* text,
int64_t offset = nativeIndex - text->chunkNativeStart;
// Ensure chunk offset is well defined if computed offset exceeds int32_t
// range or chunk length.
- ASSERT(offset <= std::numeric_limits<int32_t>::max());
+ DCHECK_LE(offset, std::numeric_limits<int32_t>::max());
text->chunkOffset = std::min(offset <= std::numeric_limits<int32_t>::max()
? static_cast<int32_t>(offset)
: 0,
@@ -476,7 +476,7 @@ static void textUTF16SwitchToPriorContext(UText* text,
int64_t nativeIndex,
int64_t nativeLength,
UBool forward) {
- ASSERT(!text->chunkContents || text->chunkContents == text->p);
+ DCHECK(!text->chunkContents || text->chunkContents == text->p);
text->chunkContents = static_cast<const UChar*>(text->q);
textUTF16MoveInPriorContext(text, nativeIndex, nativeLength, forward);
}
@@ -492,7 +492,7 @@ static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward) {
nativeIndex = textPinIndex(nativeIndex, nativeLength - 1);
TextContext currentContext = textUTF16GetCurrentContext(text);
TextContext newContext = textGetContext(text, nativeIndex, forward);
- ASSERT(newContext != NoContext);
+ DCHECK_NE(newContext, NoContext);
if (newContext == currentContext) {
if (currentContext == PrimaryContext) {
textUTF16MoveInPrimaryContext(text, nativeIndex, nativeLength, forward);
@@ -502,7 +502,7 @@ static UBool textUTF16Access(UText* text, int64_t nativeIndex, UBool forward) {
} else if (newContext == PrimaryContext) {
textUTF16SwitchToPrimaryContext(text, nativeIndex, nativeLength, forward);
} else {
- ASSERT(newContext == PriorContext);
+ DCHECK_EQ(newContext, PriorContext);
textUTF16SwitchToPriorContext(text, nativeIndex, nativeLength, forward);
}
return TRUE;
@@ -531,7 +531,7 @@ static UText* textOpenUTF16(UText* text,
text = utext_setup(text, 0, status);
if (U_FAILURE(*status)) {
- ASSERT(!text);
+ DCHECK(!text);
return 0;
}
textInit(text, &textUTF16Funcs, string, length, priorContext,

Powered by Google App Engine
This is Rietveld 408576698