| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 #define WTF_CREATE_SCOPED_LOGGER(name, ...) \ | 122 #define WTF_CREATE_SCOPED_LOGGER(name, ...) \ |
| 123 WTF::ScopedLogger name(true, __VA_ARGS__) | 123 WTF::ScopedLogger name(true, __VA_ARGS__) |
| 124 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) \ | 124 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) \ |
| 125 WTF::ScopedLogger name(condition, __VA_ARGS__) | 125 WTF::ScopedLogger name(condition, __VA_ARGS__) |
| 126 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.log(__VA_ARGS__)) | 126 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.log(__VA_ARGS__)) |
| 127 | 127 |
| 128 #endif // LOG_DISABLED | 128 #endif // LOG_DISABLED |
| 129 | 129 |
| 130 } // namespace WTF | 130 } // namespace WTF |
| 131 | 131 |
| 132 // IMMEDIATE_CRASH() - Like CRASH() below but crashes in the fastest, simplest | |
| 133 // possible way with no attempt at logging. | |
| 134 #ifndef IMMEDIATE_CRASH | |
| 135 #if COMPILER(GCC) || COMPILER(CLANG) | |
| 136 #define IMMEDIATE_CRASH() __builtin_trap() | |
| 137 #else | |
| 138 #define IMMEDIATE_CRASH() ((void)(*(volatile char*)0 = 0)) | |
| 139 #endif | |
| 140 #endif | |
| 141 | |
| 142 // OOM_CRASH() - Specialization of IMMEDIATE_CRASH which will raise a custom | |
| 143 // exception on Windows to signal this is OOM and not a normal assert. | |
| 144 #ifndef OOM_CRASH | |
| 145 #if OS(WIN) | |
| 146 #define OOM_CRASH() \ | |
| 147 do { \ | |
| 148 ::RaiseException(0xE0000008, EXCEPTION_NONCONTINUABLE, 0, nullptr); \ | |
| 149 IMMEDIATE_CRASH(); \ | |
| 150 } while (0) | |
| 151 #else | |
| 152 #define OOM_CRASH() IMMEDIATE_CRASH() | |
| 153 #endif | |
| 154 #endif | |
| 155 | |
| 156 // CRASH() - Raises a fatal error resulting in program termination and | 132 // CRASH() - Raises a fatal error resulting in program termination and |
| 157 // triggering either the debugger or the crash reporter. | 133 // triggering either the debugger or the crash reporter. |
| 158 // | 134 // |
| 159 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. | 135 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. |
| 160 // Macro is enabled in both debug and release mode. | 136 // Macro is enabled in both debug and release mode. |
| 161 // To test for unknown errors and verify assumptions, use ASSERT instead, to | 137 // To test for unknown errors and verify assumptions, use ASSERT instead, to |
| 162 // avoid impacting performance in release builds. | 138 // avoid impacting performance in release builds. |
| 163 #ifndef CRASH | 139 #ifndef CRASH |
| 164 #if COMPILER(MSVC) | 140 #if COMPILER(MSVC) |
| 165 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH()) | 141 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH()) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return static_cast<thisType&>(argumentName); \ | 262 return static_cast<thisType&>(argumentName); \ |
| 287 } \ | 263 } \ |
| 288 inline const thisType& to##thisType(const argumentType& argumentName) { \ | 264 inline const thisType& to##thisType(const argumentType& argumentName) { \ |
| 289 SECURITY_DCHECK(referencePredicate); \ | 265 SECURITY_DCHECK(referencePredicate); \ |
| 290 return static_cast<const thisType&>(argumentName); \ | 266 return static_cast<const thisType&>(argumentName); \ |
| 291 } \ | 267 } \ |
| 292 void to##thisType(const thisType*); \ | 268 void to##thisType(const thisType*); \ |
| 293 void to##thisType(const thisType&) | 269 void to##thisType(const thisType&) |
| 294 | 270 |
| 295 #endif // WTF_Assertions_h | 271 #endif // WTF_Assertions_h |
| OLD | NEW |