diff options
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h index 171434b..6d9feb6 100644 --- a/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h +++ b/Source/WebKit/android/WebCoreSupport/ChromiumIncludes.h @@ -31,6 +31,11 @@ #include "config.h" +// Include log.h before any Chromium headers to make sure we pick up +// ALOG_ASSERT and LOG_ASSERT (if present). +// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP. +#include <cutils/log.h> + // Undefine LOG before including chrome code, and if it was defined attempt to // set the macro to the Android logging macro (which is the only one that // actually logs). @@ -40,6 +45,16 @@ #undef LOG #endif +// In AOSP, the framework still uses LOG_ASSERT (as well as ALOG_ASSERT), which +// conflicts with Chromium's LOG_ASSERT. So if defined, we undefine LOG_ASSERT +// before including Chromium code, then afterwards define it back to the +// framework macro. +// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP. +#ifdef LOG_ASSERT +#define LOG_ASSERT_WAS_DEFINED +#undef LOG_ASSERT +#endif + // Chromium won't build without NDEBUG set, so we set it for all source files // that use Chromium code. This means that if NDEBUG was previously unset, we // have to redefine ASSERT() to a no-op, as this is enabled in debug builds. @@ -110,4 +125,12 @@ #define LOG(priority, tag, ...) LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__) #endif +// If LOG_ASSERT was defined, restore it to the framework macro. +// TODO: Remove this once LOG_ASSERT is removed from the framework in AOSP. +#ifdef LOG_ASSERT_WAS_DEFINED +#undef LOG_ASSERT +// Copied from log.h. +#define LOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__) +#endif + #endif |