Chromium Code Reviews| Index: base/logging.h |
| diff --git a/base/logging.h b/base/logging.h |
| index adf8fde620e4ddd8eb87b5453f6afca8f83f58fa..4acb72203198b0bb02adbaa14b4e9bc38071a42d 100644 |
| --- a/base/logging.h |
| +++ b/base/logging.h |
| @@ -637,11 +637,17 @@ enum { DEBUG_MODE = ENABLE_DLOG }; |
| #if DCHECK_IS_ON() |
| +// If DCHECK is configured to dump-without-crashing then omit these, so that |
| +// anything using them directly will break the build. See crbug.com/596231. |
| +#if !defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| + |
| #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; |
| +#endif // !defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| + |
| #else // DCHECK_IS_ON() |
| // These are just dummy values. |
| @@ -670,6 +676,17 @@ const LogSeverity LOG_DCHECK = LOG_INFO; |
| LAZY_STREAM(PLOG_STREAM(DCHECK), false) \ |
| << "Check failed: " #condition ". " |
| +#elif defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| +// DCHECK is configured to dump-without-crashing, rather than logging. |
| +// See crbug.com/596231. |
| + |
| +BASE_EXPORT void DCheckDumpWithoutCrashing(); |
| + |
| +#define DCHECK(condition) (condition) ? (void) 0 : logging::DCheckDumpWithoutCrashing(), EAT_STREAM_PARAMETERS |
|
scottmg
2016/03/21 17:28:12
extra spaces and 80col
Wez
2016/03/23 04:18:13
Done.
|
| + |
| +// Since we're uploading a crash dump, not logging, DPCHECK behaves identically. |
| +#define DPCHECK(condition) DCHECK(condition) |
| + |
| #else // _PREFAST_ |
| #define DCHECK(condition) \ |
| @@ -684,6 +701,16 @@ const LogSeverity LOG_DCHECK = LOG_INFO; |
| // Helper macro for binary operators. |
| // Don't use this macro directly in your code, use DCHECK_EQ et al below. |
| + |
| +#if defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
| +// DCHECK is configured to dump-without-crashing, rather than logging. |
| +// See crbug.com/596231. |
| + |
| +// Use logging::Check*Impl() to ensure that operator<<()s don't go unused. |
| +#define DCHECK_OP(name, op, val1, val2) DCHECK(logging::Check##name##Impl((val1), (val2), #val1 " " #op " " #val2)) |
|
scottmg
2016/03/21 17:28:12
80col
Wez
2016/03/23 04:18:13
Done.
(git cl format does macros - awesome!)
|
| + |
| +#else |
| + |
| // The 'switch' is used to prevent the 'else' from being ambiguous when the |
| // macro is used in an 'if' clause such as: |
| // if (a == 1) |
| @@ -699,6 +726,8 @@ const LogSeverity LOG_DCHECK = LOG_INFO; |
| logging::LogMessage(__FILE__, __LINE__, ::logging::LOG_DCHECK, \ |
| true_if_passed.message()).stream() |
| +#endif |
| + |
| // 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, ...) |