Title: [239479] branches/safari-606-branch/Source/WebKit
Revision
239479
Author
[email protected]
Date
2018-12-20 17:15:46 -0800 (Thu, 20 Dec 2018)

Log Message

Apply patch. rdar://problem/46881088

Modified Paths


Diff

Modified: branches/safari-606-branch/Source/WebKit/ChangeLog (239478 => 239479)


--- branches/safari-606-branch/Source/WebKit/ChangeLog	2018-12-21 00:58:45 UTC (rev 239478)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog	2018-12-21 01:15:46 UTC (rev 239479)
@@ -1,3 +1,26 @@
+2018-12-20  Alan Coon  <[email protected]>
+
+        Apply patch. rdar://problem/46881088
+
+    2018-12-20  Suresh Koppisetty  <[email protected]>
+
+            Don’t use the main queue to create an XPC connection.
+            https://bugs.webkit.org/show_bug.cgi?id=191160
+            <rdar://problem/45736262>
+
+            Reviewed by Geoffrey Garen.
+
+            Don't use the main queue to create an XPC connection. xpc_connection_set_bootstrap does
+            dispatch_mach_send_barrier_f on this queue which delays the sending of the subsequent
+            bootstrap message (sent to launchd for launching a new target process) when the main queue is busy.
+
+            Now that the XPC connection runs on the default concurrent queue, errorHandler could be invoked
+            by any thread. The job of errorHandler is to dispatch errorHandlerImpl to the main thread,
+            where errorHandlerImpl is responsible for the actual handling of errors if any.
+
+            * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+            (WebKit::ProcessLauncher::launchProcess):
+
 2018-12-19  Alan Coon  <[email protected]>
 
         Apply patch. rdar://problem/46848447

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (239478 => 239479)


--- branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-12-21 00:58:45 UTC (rev 239478)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2018-12-21 01:15:46 UTC (rev 239479)
@@ -101,7 +101,7 @@
 {
     ASSERT(!m_xpcConnection);
 
-    m_xpcConnection = adoptOSObject(xpc_connection_create(serviceName(m_launchOptions), dispatch_get_main_queue()));
+    m_xpcConnection = adoptOSObject(xpc_connection_create(serviceName(m_launchOptions), nullptr));
 
     uuid_t uuid;
     uuid_generate(uuid);
@@ -200,8 +200,7 @@
 
     xpc_dictionary_set_value(bootstrapMessage.get(), "extra-initialization-data", extraInitializationData.get());
 
-    auto weakProcessLauncher = makeWeakPtr(*this);
-    auto errorHandler = [weakProcessLauncher, listeningPort](xpc_object_t event) {
+    auto errorHandlerImpl = [weakProcessLauncher = makeWeakPtr(*this), listeningPort] (xpc_object_t event) {
         ASSERT(!event || xpc_get_type(event) == XPC_TYPE_ERROR);
 
         auto processLauncher = weakProcessLauncher.get();
@@ -230,14 +229,18 @@
         processLauncher->didFinishLaunchingProcess(0, IPC::Connection::Identifier());
     };
 
+    auto errorHandler = [errorHandlerImpl = WTFMove(errorHandlerImpl)] (xpc_object_t event) mutable {
+        RunLoop::main().dispatch([errorHandlerImpl = WTFMove(errorHandlerImpl), event] {
+            errorHandlerImpl(event);
+        });
+    };
+
     xpc_connection_set_event_handler(m_xpcConnection.get(), errorHandler);
 
     xpc_connection_resume(m_xpcConnection.get());
 
     if (UNLIKELY(m_launchOptions.shouldMakeProcessLaunchFailForTesting)) {
-        RunLoop::main().dispatch([errorHandler = WTFMove(errorHandler)] {
-            errorHandler(nullptr);
-        });
+        errorHandler(nullptr);
         return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to