Index: third_party/WebKit/Source/wtf/Assertions.h |
diff --git a/third_party/WebKit/Source/wtf/Assertions.h b/third_party/WebKit/Source/wtf/Assertions.h |
index a5fcb9a65f919a0f1d1118732c7cadc551f4b3a0..c21ac3566793859c75ed1ff04ab6a703293c6456 100644 |
--- a/third_party/WebKit/Source/wtf/Assertions.h |
+++ b/third_party/WebKit/Source/wtf/Assertions.h |
@@ -40,6 +40,7 @@ |
*/ |
+#include "base/logging.h" |
#include "wtf/Compiler.h" |
#include "wtf/Noncopyable.h" |
#include "wtf/WTFExport.h" |
@@ -213,11 +214,13 @@ using WTF::ScopedLogger; |
#endif |
-/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED |
- |
- These macros are compiled out of release builds. |
- Expressions inside them are evaluated in debug builds only. |
-*/ |
+// ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED |
+// These macros are compiled out of release builds. |
+// Expressions inside them are evaluated in debug builds only. |
+// They are deprecated. We should use: |
+// - DCHECK() for ASSERT() |
+// - NOTREACHED() for ASSERT_NOT_REACHED() |
+// - DCHECK() and ALLOW_UNUSED_LOCAL() for ASSERT_UNUSED(). |
#if OS(WIN) |
/* FIXME: Change to use something other than ASSERT to avoid this conflict with the underlying platform */ |
#undef ASSERT |
@@ -289,8 +292,8 @@ using WTF::ScopedLogger; |
#define ENABLE_SECURITY_ASSERT 0 |
#endif |
-/* ASSERT_WITH_MESSAGE */ |
- |
+// ASSERT_WITH_MESSAGE |
+// This is deprecated. We should use DCHECK() << "message". |
#if ASSERT_MSG_DISABLED |
#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) |
#else |
@@ -302,8 +305,9 @@ using WTF::ScopedLogger; |
while (0) |
#endif |
-/* ASSERT_WITH_MESSAGE_UNUSED */ |
- |
+// ASSERT_WITH_MESSAGE_UNUSED |
+// This is deprecated. We should use DCHECK() << "message" and |
+// ALLOW_UNUSED_LOCAL(). |
esprehn
2016/03/18 04:58:30
Why do you need to use ALLOW_UNUSED_LOCAL ?
tkent
2016/03/18 05:19:20
to avoid "unused variable" warning in release buil
|
#if ASSERT_MSG_DISABLED |
#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable) |
#else |
@@ -332,8 +336,8 @@ while (0) |
#endif |
-/* FATAL */ |
- |
+// FATAL |
+// This is deprecated. We should use DLOG(FATAL) << ... |
#if FATAL_DISABLED |
#define FATAL(...) ((void)0) |
#else |
@@ -343,16 +347,17 @@ while (0) |
} while (0) |
#endif |
-/* WTF_LOG_ERROR */ |
- |
+// WTF_LOG_ERROR |
+// This is deprecated. We should use DLOG(ERROR) << ... |
#if ERROR_DISABLED |
#define WTF_LOG_ERROR(...) ((void)0) |
#else |
#define WTF_LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) |
#endif |
-/* WTF_LOG */ |
- |
+// WTF_LOG |
+// This is deprecated. Should be replaced with DVLOG(verboselevel), which works |
+// only in debug build, or VLOG(verboselevel), which works in release build too. |
#if LOG_DISABLED |
#define WTF_LOG(channel, ...) ((void)0) |
#else |
@@ -384,7 +389,10 @@ static inline void UNREACHABLE_FOR_PLATFORM() |
Please sure to file bugs for these failures using the security template: |
http://code.google.com/p/chromium/issues/entry?template=Security%20Bug |
*/ |
- |
+// RELEASE_ASSERT* are deprecated. We should use: |
+// - CHECK() for RELEASE_ASSERT() |
+// - CHECK() << message for RELEASE_ASSERT_WITH_MESSAGE() |
+// - LOG(FATAL) for RELEASE_ASSERT_NOT_REACHED(). |
esprehn
2016/03/18 04:58:31
LOG(FATAL) is less clear, we should add a release
tkent
2016/03/18 05:19:20
ok, I added RELEASE_NOTREACHED() here.
|
#if ENABLE(ASSERT) |
#define RELEASE_ASSERT(assertion) ASSERT(assertion) |
#define RELEASE_ASSERT_WITH_MESSAGE(assertion, ...) ASSERT_WITH_MESSAGE(assertion, __VA_ARGS__) |