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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #define WTF_CREATE_SCOPED_LOGGER(name, ...) \ | 102 #define WTF_CREATE_SCOPED_LOGGER(name, ...) \ |
103 WTF::ScopedLogger name(true, __VA_ARGS__) | 103 WTF::ScopedLogger name(true, __VA_ARGS__) |
104 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) \ | 104 #define WTF_CREATE_SCOPED_LOGGER_IF(name, condition, ...) \ |
105 WTF::ScopedLogger name(condition, __VA_ARGS__) | 105 WTF::ScopedLogger name(condition, __VA_ARGS__) |
106 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.Log(__VA_ARGS__)) | 106 #define WTF_APPEND_SCOPED_LOGGER(name, ...) (name.Log(__VA_ARGS__)) |
107 | 107 |
108 #endif // LOG_DISABLED | 108 #endif // LOG_DISABLED |
109 | 109 |
110 } // namespace WTF | 110 } // namespace WTF |
111 | 111 |
112 // CRASH() - Raises a fatal error resulting in program termination and | |
113 // triggering either the debugger or the crash reporter. | |
114 // | |
115 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. | |
116 // Macro is enabled in both debug and release mode. | |
117 // To test for unknown errors and verify assumptions, use ASSERT instead, to | |
118 // avoid impacting performance in release builds. | |
119 #ifndef CRASH | |
120 #define CRASH() IMMEDIATE_CRASH() | |
121 #endif | |
122 | |
123 #define DCHECK_AT(assertion, file, line) \ | 112 #define DCHECK_AT(assertion, file, line) \ |
124 LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ | 113 LAZY_STREAM(logging::LogMessage(file, line, #assertion).stream(), \ |
125 DCHECK_IS_ON() ? !(assertion) : false) | 114 DCHECK_IS_ON() ? !(assertion) : false) |
126 | 115 |
127 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure | 116 // Users must test "#if ENABLE(SECURITY_ASSERT)", which helps ensure |
128 // that code testing this macro has included this header. | 117 // that code testing this macro has included this header. |
129 #if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() | 118 #if defined(ADDRESS_SANITIZER) || DCHECK_IS_ON() |
130 #define ENABLE_SECURITY_ASSERT 1 | 119 #define ENABLE_SECURITY_ASSERT 1 |
131 #else | 120 #else |
132 #define ENABLE_SECURITY_ASSERT 0 | 121 #define ENABLE_SECURITY_ASSERT 0 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return static_cast<thisType&>(argument); \ | 205 return static_cast<thisType&>(argument); \ |
217 } \ | 206 } \ |
218 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ | 207 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ |
219 CHECK(referencePredicate); \ | 208 CHECK(referencePredicate); \ |
220 return static_cast<const thisType&>(argument); \ | 209 return static_cast<const thisType&>(argument); \ |
221 } \ | 210 } \ |
222 void To##thisType##OrDie(const thisType*); \ | 211 void To##thisType##OrDie(const thisType*); \ |
223 void To##thisType##OrDie(const thisType&) | 212 void To##thisType##OrDie(const thisType&) |
224 | 213 |
225 #endif // WTF_Assertions_h | 214 #endif // WTF_Assertions_h |
OLD | NEW |