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

Unified Diff: third_party/WebKit/Source/wtf/Assertions.h

Issue 2288473002: Implement Dump-on-DCHECK (via a new LogSeverity). (Closed)
Patch Set: Migrate some tests to EXPECT_DCHECK_DEATH Created 4 years 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/wtf/Assertions.h
diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h
index db71532243b89a103a0bb64e8fd75fe840260266..fc4da7bfc1881745d359d65e4f447182815b7878 100644
--- a/third_party/WebKit/Source/wtf/Assertions.h
+++ b/third_party/WebKit/Source/wtf/Assertions.h
@@ -49,12 +49,7 @@
// Users must test "#if ENABLE(ASSERT)", which helps ensure that code
// testing this macro has included this header.
#ifndef ENABLE_ASSERT
-#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
-/* Disable ASSERT* macros in release mode by default. */
-#define ENABLE_ASSERT 0
-#else
-#define ENABLE_ASSERT 1
-#endif /* defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) */
+#define ENABLE_ASSERT DCHECK_IS_ON()
#endif
#ifndef LOG_DISABLED
@@ -157,6 +152,18 @@ class WTF_EXPORT ScopedLogger {
#undef ASSERT
#endif
+// If DCHECK is configured to dump-without-crashing then enable assertions,
+// but also configure them to dump-without-crashing.
+#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
+
+#define ASSERT(assertion) DCHECK(assertion)
+#define ASSERT_NOT_REACHED() NOTREACHED()
Wez 2016/12/19 23:57:46 Note that this has significant performance implica
esprehn 2016/12/20 03:16:29 What was the perf change? Not sure I understand ho
Wez 2017/01/07 00:18:47 Earlier versions of the patch left Blink assertion
+
+// |file| and |line| won't actually be logged, but must be referenced.
+#define DCHECK_AT(assertion, file, line) DCHECK(assertion) << file << line
+
+#else // defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
+
#define DCHECK_AT(assertion, file, line) \
LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \
DCHECK_IS_ON() ? !(assertion) : false)
@@ -182,6 +189,8 @@ class WTF_EXPORT ScopedLogger {
#endif
+#endif // defined(DCHECK_ALWAYS_ON)
+
// Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure
// that code testing this macro has included this header.
#if defined(ADDRESS_SANITIZER) || ENABLE(ASSERT)

Powered by Google App Engine
This is Rietveld 408576698