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

Side by Side Diff: third_party/WebKit/Source/wtf/Assertions.h

Issue 1884023002: Implement Dump-on-DCHECK (via alternate DCHECK and DCHECK_OP macro implementations). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on cleanups Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « build/config/dcheck_always_on.gni ('k') | third_party/WebKit/Source/wtf/AssertionsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Expressions inside them are evaluated in debug builds only. 127 // Expressions inside them are evaluated in debug builds only.
128 // They are deprecated. We should use: 128 // They are deprecated. We should use:
129 // - DCHECK() for ASSERT() 129 // - DCHECK() for ASSERT()
130 // - NOTREACHED() for ASSERT_NOT_REACHED() 130 // - NOTREACHED() for ASSERT_NOT_REACHED()
131 #if OS(WIN) 131 #if OS(WIN)
132 // FIXME: Change to use something other than ASSERT to avoid this conflict with 132 // FIXME: Change to use something other than ASSERT to avoid this conflict with
133 // the underlying platform. 133 // the underlying platform.
134 #undef ASSERT 134 #undef ASSERT
135 #endif 135 #endif
136 136
137 #define DCHECK_AT(assertion, file, line) \ 137 #if defined(DCHECK_IS_DUMP_WITHOUT_CRASH)
138 LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ 138 // In dump-on-DCHECK builds there is no log message, but |file| and |line must
139 // still be referenced, so log them; the dump-on-DCHECK impl will not actually
140 // log them.
141 // See crbug.com/596231.
142 #define DCHECK_AT(assertion, file, line) DCHECK(assertion) << file << line
143 #else
144 #define DCHECK_AT(assertion, file, line) \
145 LAZY_STREAM(logging::LogMessage(file, line, logging::LOG_DCHECK).stream(), \
139 DCHECK_IS_ON() ? !(assertion) : false) 146 DCHECK_IS_ON() ? !(assertion) : false)
147 #endif
140 148
141 #if DCHECK_IS_ON() 149 #if DCHECK_IS_ON()
142 #define ASSERT(assertion) DCHECK(assertion) 150 #define ASSERT(assertion) DCHECK(assertion)
143 #define ASSERT_NOT_REACHED() NOTREACHED() 151 #define ASSERT_NOT_REACHED() NOTREACHED()
144 #else 152 #else
145 #define ASSERT(assertion) ((void)0) 153 #define ASSERT(assertion) ((void)0)
146 #define ASSERT_NOT_REACHED() ((void)0) 154 #define ASSERT_NOT_REACHED() ((void)0)
147 #endif 155 #endif
148 156
149 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure 157 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return static_cast<thisType&>(argument); \ 257 return static_cast<thisType&>(argument); \
250 } \ 258 } \
251 inline const thisType& to##thisType##OrDie(const argumentType& argument) { \ 259 inline const thisType& to##thisType##OrDie(const argumentType& argument) { \
252 CHECK(referencePredicate); \ 260 CHECK(referencePredicate); \
253 return static_cast<const thisType&>(argument); \ 261 return static_cast<const thisType&>(argument); \
254 } \ 262 } \
255 void to##thisType##OrDie(const thisType*); \ 263 void to##thisType##OrDie(const thisType*); \
256 void to##thisType##OrDie(const thisType&) 264 void to##thisType##OrDie(const thisType&)
257 265
258 #endif // WTF_Assertions_h 266 #endif // WTF_Assertions_h
OLDNEW
« no previous file with comments | « build/config/dcheck_always_on.gni ('k') | third_party/WebKit/Source/wtf/AssertionsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698