Index: base/logging.h |
diff --git a/base/logging.h b/base/logging.h |
index 5174e6d375540cd0f0bf355034c17812a66bf37b..7cc4ebb386619953dde5448e6e829e80817ca7a7 100644 |
--- a/base/logging.h |
+++ b/base/logging.h |
@@ -297,10 +297,13 @@ const LogSeverity LOG_INFO = 0; |
const LogSeverity LOG_WARNING = 1; |
const LogSeverity LOG_ERROR = 2; |
const LogSeverity LOG_FATAL = 3; |
-const LogSeverity LOG_NUM_SEVERITIES = 4; |
+const LogSeverity LOG_DUMP = 4; |
+const LogSeverity LOG_NUM_SEVERITIES = 5; |
// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode |
-#ifdef NDEBUG |
+#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
+const LogSeverity LOG_DFATAL = LOG_DUMP; |
+#elif NDEBUG |
const LogSeverity LOG_DFATAL = LOG_ERROR; |
#else |
const LogSeverity LOG_DFATAL = LOG_FATAL; |
@@ -694,9 +697,9 @@ enum { DEBUG_MODE = DCHECK_IS_ON() }; |
#if DCHECK_IS_ON() |
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
- COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) |
-#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL |
-const LogSeverity LOG_DCHECK = LOG_FATAL; |
+ COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ##__VA_ARGS__) |
+#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_DFATAL |
+const LogSeverity LOG_DCHECK = LOG_DFATAL; |
#else // DCHECK_IS_ON() |
@@ -750,7 +753,20 @@ inline constexpr bool AnalyzerNoReturn() __attribute__((analyzer_noreturn)) { |
DCHECK_IS_ON() ? (logging::AnalyzerNoReturn() || !(condition)) : false) \ |
<< "Check failed: " #condition ". " |
-#else |
+#elif DCHECK_IS_ON() && defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
+// DCHECK is configured to dump-without-crashing, rather than logging. |
+// Since we only intend to enable this in official builds, we follow the |
+// example of CHECK_OP etc in official builds, and strip out logging. |
+// See crbug.com/596231. |
+ |
+BASE_EXPORT void DCheckDumpWithoutCrashing(); |
+ |
+#define DCHECK(condition) \ |
+ !(condition) ? ::logging::DCheckDumpWithoutCrashing() : EAT_STREAM_PARAMETERS |
+ |
+#define DPCHECK(condition) DCHECK(condition) |
+ |
+#else // DCHECK_IS_ON() && defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
#if DCHECK_IS_ON() |
@@ -768,7 +784,7 @@ inline constexpr bool AnalyzerNoReturn() __attribute__((analyzer_noreturn)) { |
#endif // DCHECK_IS_ON() |
-#endif |
+#endif // _PREFAST_ |
// Helper macro for binary operators. |
// Don't use this macro directly in your code, use DCHECK_EQ et al below. |
@@ -808,6 +824,8 @@ inline constexpr bool AnalyzerNoReturn() __attribute__((analyzer_noreturn)) { |
#endif // DCHECK_IS_ON() |
+#endif // DCHECK_IS_ON() && defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
+ |
// Equality/Inequality checks - compare two values, and log a |
// LOG_DCHECK message including the two values when the result is not |
// as expected. The values must have operator<<(ostream, ...) |