Index: public/common/WebAssertion.h |
diff --git a/public/common/WebAssertion.h b/public/common/WebAssertion.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..470da7a12558ca89c434f3dd98a0985797081284 |
--- /dev/null |
+++ b/public/common/WebAssertion.h |
@@ -0,0 +1,24 @@ |
+#ifndef WebAssertion_h |
+#define WebAssertion_h |
+ |
+#include "WebCommonExport.h" |
+ |
+namespace WebKit { |
+ |
+BLINK_COMMON_EXPORT void failedAssertion(const char* file, int line, const char* function, const char* assertion); |
+ |
+} // namespace WebKit |
+ |
+// Ideally, only use inside the public directory but outside of WEBKIT_IMPLEMENTATION blocks. (Otherwise use WTF's ASSERT.) |
+#if defined(NDEBUG) |
+#define WEBKIT_ASSERT(assertion) ((void)0) |
+#else |
+#define WEBKIT_ASSERT(assertion) do { \ |
+ if (!(assertion)) \ |
+ failedAssertion(__FILE__, __LINE__, __FUNCTION__, #assertion); \ |
+} while (0) |
+#endif |
+ |
+#define WEBKIT_ASSERT_NOT_REACHED() WEBKIT_ASSERT(0) |
+ |
+#endif // WebAssertion_h |