diff options
author | tkent <tkent@chromium.org> | 2016-03-23 11:27:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-23 18:31:14 +0000 |
commit | 9aee43b6033fc4d563e0949aba6ef3a03afc0b41 (patch) | |
tree | 5c5688abe006618005b79d92b2c8a7dfae84fe80 | |
parent | 004c6f17784c7f588bc6c1808cd009b8460f12cb (diff) | |
download | chromium_src-9aee43b6033fc4d563e0949aba6ef3a03afc0b41.zip chromium_src-9aee43b6033fc4d563e0949aba6ef3a03afc0b41.tar.gz chromium_src-9aee43b6033fc4d563e0949aba6ef3a03afc0b41.tar.bz2 |
Use DLOG_IF() for REPORT_OVERFLOW().
Stop using WTFReportError(). The old and new output follow:
Old:
ERROR: !(m_value >= 0)
../../third_party/WebKit/Source/platform/LayoutUnit.h(111) : unsigned int
blink::LayoutUnit::toUnsigned() const
New:
[93371:1295:0323/130149:16342045796099:ERROR:LayoutUnit.h(114)] LayoutUnit
overflow !(m_value >= 0) in unsigned int blink::LayoutUnit::toUnsigned() const
Also,
- Reverse the condition to enable REPORT_OVERFLOW.
In the original code, REPORT_OVERFLOW produces code if ERROR_DISABLED, that is
to say, release build. This is a regression by [1].
- Remove unused stuff in Assertions.{h,cpp}.
[1] https://chromium.googlesource.com/chromium/src/+/98b71017864f766227d319f81468db00e9a00b73%5E%21/third_party/WebKit/Source/platform/LayoutUnit.h
BUG=596760
Review URL: https://codereview.chromium.org/1827733002
Cr-Commit-Position: refs/heads/master@{#382887}
-rw-r--r-- | third_party/WebKit/Source/platform/LayoutUnit.h | 14 | ||||
-rw-r--r-- | third_party/WebKit/Source/wtf/Assertions.cpp | 22 | ||||
-rw-r--r-- | third_party/WebKit/Source/wtf/Assertions.h | 5 |
3 files changed, 3 insertions, 38 deletions
diff --git a/third_party/WebKit/Source/platform/LayoutUnit.h b/third_party/WebKit/Source/platform/LayoutUnit.h index 2d4f7c5..f41fff9 100644 --- a/third_party/WebKit/Source/platform/LayoutUnit.h +++ b/third_party/WebKit/Source/platform/LayoutUnit.h @@ -42,18 +42,10 @@ namespace blink { -#if !ERROR_DISABLED - -#define REPORT_OVERFLOW(doesOverflow) ((void)0) - +#if DCHECK_IS_ON() +#define REPORT_OVERFLOW(doesOverflow) DLOG_IF(ERROR, !(doesOverflow)) << "LayoutUnit overflow !(" << #doesOverflow << ") in " << WTF_PRETTY_FUNCTION #else - -#define REPORT_OVERFLOW(doesOverflow) do \ - if (!(doesOverflow)) { \ - WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, "!(%s)", #doesOverflow); \ - } \ -while (0) - +#define REPORT_OVERFLOW(doesOverflow) ((void)0) #endif static const int kLayoutUnitFractionalBits = 6; diff --git a/third_party/WebKit/Source/wtf/Assertions.cpp b/third_party/WebKit/Source/wtf/Assertions.cpp index f314526..fe9afbe 100644 --- a/third_party/WebKit/Source/wtf/Assertions.cpp +++ b/third_party/WebKit/Source/wtf/Assertions.cpp @@ -107,18 +107,6 @@ static void vprintf_stderr_common(const char* format, va_list args) #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif -static void vprintf_stderr_with_prefix(const char* prefix, const char* format, va_list args) -{ - size_t prefixLength = strlen(prefix); - size_t formatLength = strlen(format); - OwnPtr<char[]> formatWithPrefix = adoptArrayPtr(new char[prefixLength + formatLength + 1]); - memcpy(formatWithPrefix.get(), prefix, prefixLength); - memcpy(formatWithPrefix.get() + prefixLength, format, formatLength); - formatWithPrefix[prefixLength + formatLength] = 0; - - vprintf_stderr_common(formatWithPrefix.get(), args); -} - static void vprintf_stderr_with_trailing_newline(const char* format, va_list args) { size_t formatLength = strlen(format); @@ -261,16 +249,6 @@ void WTFPrintBacktrace(void** stack, int size) } } -void WTFReportError(const char* file, int line, const char* function, const char* format, ...) -{ - va_list args; - va_start(args, format); - vprintf_stderr_with_prefix("ERROR: ", format, args); - va_end(args); - printf_stderr_common("\n"); - printCallSite(file, line, function); -} - void WTFLog(WTFLogChannel* channel, const char* format, ...) { if (channel->state != WTFLogChannelOn) diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h index 7b55311..7446b57 100644 --- a/third_party/WebKit/Source/wtf/Assertions.h +++ b/third_party/WebKit/Source/wtf/Assertions.h @@ -66,10 +66,6 @@ #define ASSERT_ARG_DISABLED !ENABLE(ASSERT) #endif -#ifndef ERROR_DISABLED -#define ERROR_DISABLED !ENABLE(ASSERT) -#endif - #ifndef LOG_DISABLED #define LOG_DISABLED !ENABLE(ASSERT) #endif @@ -90,7 +86,6 @@ typedef struct { WTF_EXPORT void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion); WTF_EXPORT void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion); -WTF_EXPORT void WTFReportError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5); WTF_EXPORT void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3); WTF_EXPORT void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); WTF_EXPORT void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); |