| OLD | NEW |
| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // triggering either the debugger or the crash reporter. | 113 // triggering either the debugger or the crash reporter. |
| 114 // | 114 // |
| 115 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. | 115 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. |
| 116 // Macro is enabled in both debug and release mode. | 116 // Macro is enabled in both debug and release mode. |
| 117 // To test for unknown errors and verify assumptions, use ASSERT instead, to | 117 // To test for unknown errors and verify assumptions, use ASSERT instead, to |
| 118 // avoid impacting performance in release builds. | 118 // avoid impacting performance in release builds. |
| 119 #ifndef CRASH | 119 #ifndef CRASH |
| 120 #define CRASH() IMMEDIATE_CRASH() | 120 #define CRASH() IMMEDIATE_CRASH() |
| 121 #endif | 121 #endif |
| 122 | 122 |
| 123 // ASSERT | |
| 124 // These macros are compiled out of release builds. | |
| 125 // Expressions inside them are evaluated in debug builds only. | |
| 126 // This is deprecated. We should use: | |
| 127 // - DCHECK() for ASSERT() | |
| 128 #if OS(WIN) | |
| 129 // FIXME: Change to use something other than ASSERT to avoid this conflict with | |
| 130 // the underlying platform. | |
| 131 #undef ASSERT | |
| 132 #endif | |
| 133 | |
| 134 #define DCHECK_AT(assertion, file, line) \ | 123 #define DCHECK_AT(assertion, file, line) \ |
| 135 LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ | 124 LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ |
| 136 DCHECK_IS_ON() ? !(assertion) : false) | 125 DCHECK_IS_ON() ? !(assertion) : false) |
| 137 | 126 |
| 138 #if DCHECK_IS_ON() | |
| 139 #define ASSERT(assertion) DCHECK(assertion) | |
| 140 #else | |
| 141 #define ASSERT(assertion) ((void)0) | |
| 142 #endif | |
| 143 | |
| 144 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure | 127 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure |
| 145 // that code testing this macro has included this header. | 128 // that code testing this macro has included this header. |
| 146 #if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() | 129 #if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() |
| 147 #define ENABLE_SECURITY_ASSERT 1 | 130 #define ENABLE_SECURITY_ASSERT 1 |
| 148 #else | 131 #else |
| 149 #define ENABLE_SECURITY_ASSERT 0 | 132 #define ENABLE_SECURITY_ASSERT 0 |
| 150 #endif | 133 #endif |
| 151 | 134 |
| 152 // SECURITY_DCHECK and SECURITY_CHECK | 135 // SECURITY_DCHECK and SECURITY_CHECK |
| 153 // Use in places where failure of the assertion indicates a possible security | 136 // Use in places where failure of the assertion indicates a possible security |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 return static_cast<thisType&>(argument); \ | 216 return static_cast<thisType&>(argument); \ |
| 234 } \ | 217 } \ |
| 235 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ | 218 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ |
| 236 CHECK(referencePredicate); \ | 219 CHECK(referencePredicate); \ |
| 237 return static_cast<const thisType&>(argument); \ | 220 return static_cast<const thisType&>(argument); \ |
| 238 } \ | 221 } \ |
| 239 void To##thisType##OrDie(const thisType*); \ | 222 void To##thisType##OrDie(const thisType*); \ |
| 240 void To##thisType##OrDie(const thisType&) | 223 void To##thisType##OrDie(const thisType&) |
| 241 | 224 |
| 242 #endif // WTF_Assertions_h | 225 #endif // WTF_Assertions_h |
| OLD | NEW |