From d11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 11 Jan 2012 10:03:25 +0100 Subject: Imported WebKit commit 75bb2fc5882d2e1b3d5572c2961507996cbca5e3 (http://svn.webkit.org/repository/webkit/trunk@104681) --- Source/JavaScriptCore/wtf/Assertions.cpp | 46 +++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'Source/JavaScriptCore/wtf/Assertions.cpp') diff --git a/Source/JavaScriptCore/wtf/Assertions.cpp b/Source/JavaScriptCore/wtf/Assertions.cpp index de062ce25..3da67effe 100644 --- a/Source/JavaScriptCore/wtf/Assertions.cpp +++ b/Source/JavaScriptCore/wtf/Assertions.cpp @@ -98,7 +98,7 @@ static void vprintf_stderr_common(const char* format, va_list args) // Fall through to write to stderr in the same manner as other platforms. #elif PLATFORM(BLACKBERRY) - BlackBerry::Platform::logV(BlackBerry::Platform::LogLevelInfo, format, args); + BlackBerry::Platform::logStreamV(format, args); #elif HAVE(ISDEBUGGERPRESENT) if (IsDebuggerPresent()) { size_t size = 1024; @@ -133,7 +133,9 @@ static void vprintf_stderr_common(const char* format, va_list args) } while (size > 1024); } #endif +#if !PLATFORM(BLACKBERRY) vfprintf(stderr, format, args); +#endif } #if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0)) @@ -194,8 +196,26 @@ static void printCallSite(const char* file, int line, const char* function) #endif } +#if PLATFORM(BLACKBERRY) +struct WTFLogLocker { + WTFLogLocker(BlackBerry::Platform::MessageLogLevel logLevel) + { + BlackBerry::Platform::lockLogging(logLevel); + } + + ~WTFLogLocker() + { + BlackBerry::Platform::unlockLogging(); + } +}; +#endif + void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion) { +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical); +#endif + if (assertion) printf_stderr_common("ASSERTION FAILED: %s\n", assertion); else @@ -205,6 +225,10 @@ void WTFReportAssertionFailure(const char* file, int line, const char* function, void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) { +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical); +#endif + va_list args; va_start(args, format); vprintf_stderr_with_prefix("ASSERTION FAILED: ", format, args); @@ -215,6 +239,10 @@ void WTFReportAssertionFailureWithMessage(const char* file, int line, const char void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion) { +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical); +#endif + printf_stderr_common("ARGUMENT BAD: %s, %s\n", argName, assertion); printCallSite(file, line, function); } @@ -275,6 +303,10 @@ void WTFReportBacktrace() void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) { +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelCritical); +#endif + va_list args; va_start(args, format); vprintf_stderr_with_prefix("FATAL ERROR: ", format, args); @@ -285,6 +317,10 @@ void WTFReportFatalError(const char* file, int line, const char* function, const void WTFReportError(const char* file, int line, const char* function, const char* format, ...) { +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelWarn); +#endif + va_list args; va_start(args, format); vprintf_stderr_with_prefix("ERROR: ", format, args); @@ -298,6 +334,10 @@ void WTFLog(WTFLogChannel* channel, const char* format, ...) if (channel->state != WTFLogChannelOn) return; +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelInfo); +#endif + va_list args; va_start(args, format); vprintf_stderr_with_trailing_newline(format, args); @@ -309,6 +349,10 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann if (channel->state != WTFLogChannelOn) return; +#if PLATFORM(BLACKBERRY) + WTFLogLocker locker(BlackBerry::Platform::LogLevelInfo); +#endif + va_list args; va_start(args, format); vprintf_stderr_with_trailing_newline(format, args); -- cgit v1.2.1