Title: [182826] trunk/Source/_javascript_Core
Revision
182826
Author
[email protected]
Date
2015-04-14 17:47:25 -0700 (Tue, 14 Apr 2015)

Log Message

Replace _javascript_CoreOutputConsoleMessagesToSystemConsole default with an SPI
https://bugs.webkit.org/show_bug.cgi?id=143691

Reviewed by Geoffrey Garen.

* API/JSRemoteInspector.h:
* API/JSRemoteInspector.cpp:
(JSRemoteInspectorSetLogToSystemConsole):
Add SPI to enable/disable logging to the system console.
This only affects JSContext `console` logs and warnings.

* inspector/JSGlobalObjectConsoleClient.h:
* inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::logToSystemConsole):
(Inspector::JSGlobalObjectConsoleClient::setLogToSystemConsole):
(Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel):
(Inspector::JSGlobalObjectConsoleClient::initializeLogToSystemConsole): Deleted.
Simplify access to the setting now that it doesn't need to
initialize its value from preferences.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSRemoteInspector.cpp (182825 => 182826)


--- trunk/Source/_javascript_Core/API/JSRemoteInspector.cpp	2015-04-15 00:27:26 UTC (rev 182825)
+++ trunk/Source/_javascript_Core/API/JSRemoteInspector.cpp	2015-04-15 00:47:25 UTC (rev 182826)
@@ -26,11 +26,14 @@
 #include "config.h"
 #include "JSRemoteInspector.h"
 
+#include "JSGlobalObjectConsoleClient.h"
+
 #if ENABLE(REMOTE_INSPECTOR)
 #include "RemoteInspector.h"
-using namespace Inspector;
 #endif
 
+using namespace Inspector;
+
 void JSRemoteInspectorDisableAutoStart(void)
 {
 #if ENABLE(REMOTE_INSPECTOR)
@@ -56,3 +59,8 @@
     UNUSED_PARAM(auditLength);
 #endif
 }
+
+void JSRemoteInspectorSetLogToSystemConsole(bool logToSystemConsole)
+{
+    JSGlobalObjectConsoleClient::setLogToSystemConsole(logToSystemConsole);
+}

Modified: trunk/Source/_javascript_Core/API/JSRemoteInspector.h (182825 => 182826)


--- trunk/Source/_javascript_Core/API/JSRemoteInspector.h	2015-04-15 00:27:26 UTC (rev 182825)
+++ trunk/Source/_javascript_Core/API/JSRemoteInspector.h	2015-04-15 00:47:25 UTC (rev 182826)
@@ -37,6 +37,8 @@
 JS_EXPORT void JSRemoteInspectorStart(void) CF_AVAILABLE(10_11, 9_0);
 JS_EXPORT void JSRemoteInspectorSetParentProcessInformation(pid_t, const uint8_t* auditData, size_t auditLength) CF_AVAILABLE(10_11, 9_0);
 
+JS_EXPORT void JSRemoteInspectorSetLogToSystemConsole(bool) CF_AVAILABLE(10_11, 9_0);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/_javascript_Core/ChangeLog (182825 => 182826)


--- trunk/Source/_javascript_Core/ChangeLog	2015-04-15 00:27:26 UTC (rev 182825)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-04-15 00:47:25 UTC (rev 182826)
@@ -1,5 +1,27 @@
 2015-04-14  Joseph Pecoraro  <[email protected]>
 
+        Replace _javascript_CoreOutputConsoleMessagesToSystemConsole default with an SPI
+        https://bugs.webkit.org/show_bug.cgi?id=143691
+
+        Reviewed by Geoffrey Garen.
+
+        * API/JSRemoteInspector.h:
+        * API/JSRemoteInspector.cpp:
+        (JSRemoteInspectorSetLogToSystemConsole):
+        Add SPI to enable/disable logging to the system console.
+        This only affects JSContext `console` logs and warnings.
+
+        * inspector/JSGlobalObjectConsoleClient.h:
+        * inspector/JSGlobalObjectConsoleClient.cpp:
+        (Inspector::JSGlobalObjectConsoleClient::logToSystemConsole):
+        (Inspector::JSGlobalObjectConsoleClient::setLogToSystemConsole):
+        (Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel):
+        (Inspector::JSGlobalObjectConsoleClient::initializeLogToSystemConsole): Deleted.
+        Simplify access to the setting now that it doesn't need to
+        initialize its value from preferences.
+
+2015-04-14  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Auto-attach fails after r179562, initialization too late after dispatch
         https://bugs.webkit.org/show_bug.cgi?id=143682
 

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp (182825 => 182826)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp	2015-04-15 00:27:26 UTC (rev 182825)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.cpp	2015-04-15 00:47:25 UTC (rev 182826)
@@ -32,51 +32,26 @@
 #include "ScriptCallStack.h"
 #include "ScriptCallStackFactory.h"
 
-#if USE(CF)
-#include <CoreFoundation/CoreFoundation.h>
-#endif
-
 using namespace JSC;
 
 namespace Inspector {
 
+#if !LOG_DISABLED
+static bool sLogToSystemConsole = true;
+#else
 static bool sLogToSystemConsole = false;
-static bool sSetLogToSystemConsole = false;
+#endif
 
 bool JSGlobalObjectConsoleClient::logToSystemConsole()
 {
-    if (!sSetLogToSystemConsole) {
-        static std::once_flag initializeLogging;
-        std::call_once(initializeLogging, []{
-            JSGlobalObjectConsoleClient::initializeLogToSystemConsole();
-        });
-    }
     return sLogToSystemConsole;
 }
 
 void JSGlobalObjectConsoleClient::setLogToSystemConsole(bool shouldLog)
 {
-    sSetLogToSystemConsole = true;
     sLogToSystemConsole = shouldLog;
 }
 
-void JSGlobalObjectConsoleClient::initializeLogToSystemConsole()
-{
-    // If setLogToSystemConsole() was called, no need to query the default value.
-    if (sSetLogToSystemConsole)
-        return;
-
-#if !LOG_DISABLED
-    sLogToSystemConsole = true;
-#elif USE(CF)
-    Boolean keyExistsAndHasValidFormat = false;
-    Boolean preference = CFPreferencesGetAppBooleanValue(CFSTR("_javascript_CoreOutputConsoleMessagesToSystemConsole"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
-    if (keyExistsAndHasValidFormat)
-        sLogToSystemConsole = preference;
-#endif
-    sSetLogToSystemConsole = true;
-}
-
 JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient(InspectorConsoleAgent* consoleAgent)
     : ConsoleClient()
     , m_consoleAgent(consoleAgent)
@@ -85,7 +60,6 @@
 
 void JSGlobalObjectConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<ScriptArguments>&& arguments)
 {
-
     if (JSGlobalObjectConsoleClient::logToSystemConsole())
         ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments.copyRef());
 

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h (182825 => 182826)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h	2015-04-15 00:27:26 UTC (rev 182825)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectConsoleClient.h	2015-04-15 00:47:25 UTC (rev 182826)
@@ -51,8 +51,6 @@
     virtual void timeStamp(JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
 
 private:
-    static void initializeLogToSystemConsole();
-
     void warnUnimplemented(const String& method);
     void internalAddMessage(MessageType, MessageLevel, JSC::ExecState*, RefPtr<ScriptArguments>&&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to