Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/text/TextCodecICU.cpp |
| diff --git a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp |
| index b2c4d3f58a17c8be4cd1af6af838618de3809e26..4adf5eacbee7aced8cdeb99b16ecc04e4370d2fa 100644 |
| --- a/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp |
| +++ b/third_party/WebKit/Source/wtf/text/TextCodecICU.cpp |
| @@ -311,25 +311,22 @@ public: |
| : m_converter(converter) |
| , m_shouldStopOnEncodingErrors(stopOnError) |
| { |
| - if (m_shouldStopOnEncodingErrors) { |
| - UErrorCode err = U_ZERO_ERROR; |
| - ucnv_setToUCallBack(m_converter, UCNV_TO_U_CALLBACK_SUBSTITUTE, |
| - UCNV_SUB_STOP_ON_ILLEGAL, &m_savedAction, |
| - &m_savedContext, &err); |
| - ASSERT(err == U_ZERO_ERROR); |
| - } |
| + UErrorCode err = U_ZERO_ERROR; |
| + if (m_shouldStopOnEncodingErrors) |
| + ucnv_setToUCallBack(m_converter, UCNV_TO_U_CALLBACK_STOP, 0, &m_savedAction, &m_savedContext, &err); |
| + else |
| + ucnv_setToUCallBack(m_converter, UCNV_TO_U_CALLBACK_SUBSTITUTE, 0, &m_savedAction, &m_savedContext, &err); |
|
jsbell
2016/08/09 22:27:24
Maybe we only want the `if (m_shouldStopOnEncoding
jungshik at Google
2016/08/12 07:20:41
Indeed, confusing.
https://cs.chromium.org/chrom
|
| + DCHECK_EQ(err, U_ZERO_ERROR); |
| } |
| ~ErrorCallbackSetter() |
| { |
| - if (m_shouldStopOnEncodingErrors) { |
| - UErrorCode err = U_ZERO_ERROR; |
| - const void* oldContext; |
| - UConverterToUCallback oldAction; |
| - ucnv_setToUCallBack(m_converter, m_savedAction, m_savedContext, &oldAction, &oldContext, &err); |
| - ASSERT(oldAction == UCNV_TO_U_CALLBACK_SUBSTITUTE); |
| - ASSERT(!strcmp(static_cast<const char*>(oldContext), UCNV_SUB_STOP_ON_ILLEGAL)); |
| - ASSERT(err == U_ZERO_ERROR); |
| - } |
| + UErrorCode err = U_ZERO_ERROR; |
| + const void* oldContext; |
| + UConverterToUCallback oldAction; |
| + ucnv_setToUCallBack(m_converter, m_savedAction, m_savedContext, &oldAction, &oldContext, &err); |
| + DCHECK_EQ(oldAction, m_shouldStopOnEncodingErrors ? UCNV_TO_U_CALLBACK_STOP : UCNV_TO_U_CALLBACK_SUBSTITUTE); |
| + DCHECK(!oldContext); |
| + DCHECK_EQ(err, U_ZERO_ERROR); |
| } |
| private: |