Chromium Code Reviews| Index: base/logging.h |
| diff --git a/base/logging.h b/base/logging.h |
| index 07674698e0220dbd7d2ab1662556e2853adc275d..926d4cfcb68e575ca4ef082345084d9a4c4aa748 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,19 @@ 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(), \ |
|
danakj
2016/03/24 00:10:34
No DCHECK_IS_ON() check here? This will make DCHEC
danakj
2016/03/25 23:21:32
I still think this should be
DCHECK_IS_ON() && (c
Wez
2016/03/25 23:57:29
The patch forces DCHECK on, so the effect is the s
|
| + EAT_STREAM_PARAMETERS |
| + |
| +// Since we're uploading a crash dump, not logging, DPCHECK behaves identically. |
| +#define DPCHECK(condition) DCHECK(condition) |
| + |
| #else // _PREFAST_ |
| #define DCHECK(condition) \ |
| @@ -684,6 +703,17 @@ 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. |
|
danakj
2016/03/25 23:21:32
Didn't you use DCHECK() to ensure that rather? DCH
Wez
2016/03/25 23:57:29
No; you could implement this as DCHECK((val1) op (
|
| +#define DCHECK_OP(name, op, val1, val2) \ |
| + DCHECK(logging::Check##name##Impl((val1), (val2), #val1 " " #op " " #val2)) |
|
danakj
2016/03/24 00:10:34
No DCHECK_IS_ON() check here?
Wez
2016/03/25 23:57:29
Added a #if block check instead.
|
| + |
| +#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 +729,8 @@ const LogSeverity LOG_DCHECK = LOG_INFO; |
| logging::LogMessage(__FILE__, __LINE__, ::logging::LOG_DCHECK, \ |
| true_if_passed.message()).stream() |
| +#endif |
|
danakj
2016/03/25 23:21:32
comment what you're ending
Wez
2016/03/25 23:57:29
Done.
|
| + |
| // 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, ...) |