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

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

Issue 2280003003: Clean up some assertion code in WebKit. (Closed)
Patch Set: Try to fix patchset deps again Created 4 years, 3 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 | « third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h ('k') | no next file » | 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // They are deprecated. We should use: 179 // They are deprecated. We should use:
180 // - DCHECK() for ASSERT() 180 // - DCHECK() for ASSERT()
181 // - NOTREACHED() for ASSERT_NOT_REACHED() 181 // - NOTREACHED() for ASSERT_NOT_REACHED()
182 // - DCHECK() and ALLOW_UNUSED_LOCAL() for ASSERT_UNUSED(). 182 // - DCHECK() and ALLOW_UNUSED_LOCAL() for ASSERT_UNUSED().
183 #if OS(WIN) 183 #if OS(WIN)
184 // FIXME: Change to use something other than ASSERT to avoid this conflict with 184 // FIXME: Change to use something other than ASSERT to avoid this conflict with
185 // the underlying platform. 185 // the underlying platform.
186 #undef ASSERT 186 #undef ASSERT
187 #endif 187 #endif
188 188
189 #define DCHECK_AT(assertion, file, line) LAZY_STREAM(logging::LogMessage(file, l ine, #assertion).stream(), DCHECK_IS_ON() ? !(assertion) : false)
Stephen White 2016/08/27 23:20:21 Wouldn't this be clearer as #if DCHECK_IS_ON() #d
Wez 2016/08/28 01:11:36 The definition of DCHECK is specifically designed
190
189 #if ENABLE(ASSERT) 191 #if ENABLE(ASSERT)
190 192
191 #define ASSERT(assertion) \ 193 #define ASSERT(assertion) \
192 (!(assertion) ? \ 194 (!(assertion) ? \
193 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass ertion), \ 195 (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #ass ertion), \
194 CRASH()) : \ 196 CRASH()) : \
195 (void)0) 197 (void)0)
196 198
197 #define DCHECK_AT(assertion, file, line) LAZY_STREAM(logging::LogMessage(file, l ine, #assertion).stream(), !(assertion))
198
199 #define ASSERT_NOT_REACHED() do { \ 199 #define ASSERT_NOT_REACHED() do { \
200 WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \ 200 WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \
201 CRASH(); \ 201 CRASH(); \
202 } while (0) 202 } while (0)
203 203
204 #define ASSERT_UNUSED(variable, assertion) ASSERT(assertion) 204 #define ASSERT_UNUSED(variable, assertion) ASSERT(assertion)
205 205
206 #define NO_RETURN_DUE_TO_ASSERT NO_RETURN_DUE_TO_CRASH 206 #define NO_RETURN_DUE_TO_ASSERT NO_RETURN_DUE_TO_CRASH
207 207
208 #else 208 #else
209 209
210 #define ASSERT(assertion) ((void)0) 210 #define ASSERT(assertion) ((void)0)
211 #define DCHECK_AT(assertion, file, line) EAT_STREAM_PARAMETERS
212 #define ASSERT_NOT_REACHED() ((void)0) 211 #define ASSERT_NOT_REACHED() ((void)0)
213 #define NO_RETURN_DUE_TO_ASSERT 212 #define NO_RETURN_DUE_TO_ASSERT
214 213
215 #define ASSERT_UNUSED(variable, assertion) ((void)variable) 214 #define ASSERT_UNUSED(variable, assertion) ((void)variable)
216 215
217 #endif 216 #endif
218 217
219 // ASSERT_WITH_SECURITY_IMPLICATION 218 // ASSERT_WITH_SECURITY_IMPLICATION
220 // It is deprecated. ASSERT_WITH_SECURITY_IMPLICATION should be replaced 219 // It is deprecated. ASSERT_WITH_SECURITY_IMPLICATION should be replaced
221 // with SECURITY_DCHECK. 220 // with SECURITY_DCHECK.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } \ 302 } \
304 inline const thisType& to##thisType(const argumentType& argumentName) \ 303 inline const thisType& to##thisType(const argumentType& argumentName) \
305 { \ 304 { \
306 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ 305 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
307 return static_cast<const thisType&>(argumentName); \ 306 return static_cast<const thisType&>(argumentName); \
308 } \ 307 } \
309 void to##thisType(const thisType*); \ 308 void to##thisType(const thisType*); \
310 void to##thisType(const thisType&) 309 void to##thisType(const thisType&)
311 310
312 #endif // WTF_Assertions_h 311 #endif // WTF_Assertions_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698