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

Unified Diff: public/common/WebAssertion.h

Issue 15079005: Create a minimal webkit_common static library for use in browser process (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698