Title: [104491] trunk/Source/_javascript_Core
Revision
104491
Author
[email protected]
Date
2012-01-09 14:06:18 -0800 (Mon, 09 Jan 2012)

Log Message

Log is a little to verbose for blackberry port
https://bugs.webkit.org/show_bug.cgi?id=75728

The BlackBerry::Platform::Log* functions take care of the call to vfprintf
which is resulting in unintentional noise in our logs.  Add a conditional
directive to fix.

Change to using BlackBerry::Platform::logStreamV which does not insert
threading info and newlines unlike BlackBerry::Platform::log.

Finally, add log locking and unlocking which the BlackBerry platform
uses to ensure that N threads do not trample on each other's logs.

Patch by Adam Treat <[email protected]> on 2012-01-09
Reviewed by Rob Buis.

* wtf/Assertions.cpp:
(WTFLogLocker::WTFReportAssertionFailure):
(WTFLogLocker::WTFReportAssertionFailureWithMessage):
(WTFLogLocker::WTFReportArgumentAssertionFailure):
(WTFLogLocker::WTFReportFatalError):
(WTFLogLocker::WTFReportError):
(WTFLogLocker::WTFLog):
(WTFLogLocker::WTFLogVerbose):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (104490 => 104491)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-09 22:02:29 UTC (rev 104490)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-09 22:06:18 UTC (rev 104491)
@@ -1,3 +1,29 @@
+2012-01-09  Adam Treat  <[email protected]>
+
+        Log is a little to verbose for blackberry port
+        https://bugs.webkit.org/show_bug.cgi?id=75728
+
+        The BlackBerry::Platform::Log* functions take care of the call to vfprintf
+        which is resulting in unintentional noise in our logs.  Add a conditional
+        directive to fix.
+
+        Change to using BlackBerry::Platform::logStreamV which does not insert
+        threading info and newlines unlike BlackBerry::Platform::log.
+
+        Finally, add log locking and unlocking which the BlackBerry platform
+        uses to ensure that N threads do not trample on each other's logs.
+
+        Reviewed by Rob Buis.
+
+        * wtf/Assertions.cpp:
+        (WTFLogLocker::WTFReportAssertionFailure):
+        (WTFLogLocker::WTFReportAssertionFailureWithMessage):
+        (WTFLogLocker::WTFReportArgumentAssertionFailure):
+        (WTFLogLocker::WTFReportFatalError):
+        (WTFLogLocker::WTFReportError):
+        (WTFLogLocker::WTFLog):
+        (WTFLogLocker::WTFLogVerbose):
+
 2012-01-09  Gavin Barraclough  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=75789

Modified: trunk/Source/_javascript_Core/wtf/Assertions.cpp (104490 => 104491)


--- trunk/Source/_javascript_Core/wtf/Assertions.cpp	2012-01-09 22:02:29 UTC (rev 104490)
+++ trunk/Source/_javascript_Core/wtf/Assertions.cpp	2012-01-09 22:06:18 UTC (rev 104491)
@@ -98,7 +98,7 @@
     // 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 @@
         } 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 @@
 #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 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 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 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 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 @@
     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 @@
     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);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to