Title: [237901] trunk/Source/WebKit
- Revision
- 237901
- Author
- [email protected]
- Date
- 2018-11-06 16:19:14 -0800 (Tue, 06 Nov 2018)
Log Message
Don’t use the main queue to create an XPC connection.
https://bugs.webkit.org/show_bug.cgi?id=191160
<rdar://problem/45736262>
Patch by Suresh Koppisetty <[email protected]> on 2018-11-06
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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (237900 => 237901)
--- trunk/Source/WebKit/ChangeLog 2018-11-07 00:07:19 UTC (rev 237900)
+++ trunk/Source/WebKit/ChangeLog 2018-11-07 00:19:14 UTC (rev 237901)
@@ -1,3 +1,22 @@
+2018-11-06 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-11-06 Brian Burg <[email protected]>
Add missing iOS availability macro to _WKAutomationSessionConfiguration
Modified: trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm (237900 => 237901)
--- trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2018-11-07 00:07:19 UTC (rev 237900)
+++ trunk/Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2018-11-07 00:19:14 UTC (rev 237901)
@@ -101,7 +101,7 @@
else
name = serviceName(m_launchOptions);
- m_xpcConnection = adoptOSObject(xpc_connection_create(name, dispatch_get_main_queue()));
+ m_xpcConnection = adoptOSObject(xpc_connection_create(name, nullptr));
uuid_t uuid;
uuid_generate(uuid);
@@ -194,8 +194,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();
@@ -224,14 +223,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