Use xpc_connection_set_oneshot_instance where possible
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jun 2015 00:26:35 +0000 (00:26 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Jun 2015 00:26:35 +0000 (00:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145535
rdar://problem/21109994

Reviewed by Sam Weinig.

Source/WebKit2:

Use xpc_connection_set_oneshot_instance where possible; this will make sure that the
web process instances go away when the web process exits.

* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
(WebKit::connectToReExecService):

Source/WTF:

Add SPI declaration.

* wtf/spi/darwin/XPCSPI.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185090 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/spi/darwin/XPCSPI.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

index afc15ef..bf2bf46 100644 (file)
@@ -1,3 +1,15 @@
+2015-06-01  Anders Carlsson  <andersca@apple.com>
+
+        Use xpc_connection_set_oneshot_instance where possible
+        https://bugs.webkit.org/show_bug.cgi?id=145535
+        rdar://problem/21109994
+
+        Reviewed by Sam Weinig.
+
+        Add SPI declaration.
+
+        * wtf/spi/darwin/XPCSPI.h:
+
 2015-05-29  Anders Carlsson  <andersca@apple.com>
 
         Missing #import of Platform.h in several WTF headers
index fc05501..089c250 100644 (file)
@@ -143,6 +143,7 @@ EXTERN_C void xpc_dictionary_set_mach_send(xpc_object_t, const char*, mach_port_
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 EXTERN_C void xpc_connection_set_bootstrap(xpc_connection_t, xpc_object_t bootstrap);
 EXTERN_C xpc_object_t xpc_copy_bootstrap(void);
+EXTERN_C void xpc_connection_set_oneshot_instance(xpc_connection_t, uuid_t instance);
 #endif
 
 #if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
index 1f61629..e59ac85 100644 (file)
@@ -1,3 +1,18 @@
+2015-06-01  Anders Carlsson  <andersca@apple.com>
+
+        Use xpc_connection_set_oneshot_instance where possible
+        https://bugs.webkit.org/show_bug.cgi?id=145535
+        rdar://problem/21109994
+
+        Reviewed by Sam Weinig.
+
+        Use xpc_connection_set_oneshot_instance where possible; this will make sure that the 
+        web process instances go away when the web process exits.
+
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::connectToService):
+        (WebKit::connectToReExecService):
+
 2015-06-01  Enrica Casucci  <enrica@apple.com>
 
         [iOS] Hardware Keyboard: Command + left arrow does not work.
index ace95c5..eaa9ccf 100644 (file)
@@ -219,7 +219,11 @@ static void connectToService(const ProcessLauncher::LaunchOptions& launchOptions
 {
     // Create a connection to the WebKit XPC service.
     auto connection = adoptOSObject(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    xpc_connection_set_oneshot_instance(connection.get(), instanceUUID->uuid);
+#else
     xpc_connection_set_instance(connection.get(), instanceUUID->uuid);
+#endif
 
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     // Inherit UI process localization. It can be different from child process default localization:
@@ -330,14 +334,17 @@ static void connectToReExecService(const ProcessLauncher::LaunchOptions& launchO
     }
 #endif
 
-    // Generate the uuid for the service instance we are about to create.
     // FIXME: This UUID should be stored on the ChildProcessProxy.
     RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create();
 
     // FIXME: It would be nice if we could use OSObjectPtr for this connection as well, but we'd have to be careful
     // not to introduce any retain cycles in the call to xpc_connection_set_event_handler below.
     xpc_connection_t reExecConnection = xpc_connection_create(serviceName(launchOptions, true), 0);
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+    xpc_connection_set_oneshot_instance(reExecConnection, instanceUUID->uuid);
+#else
     xpc_connection_set_instance(reExecConnection, instanceUUID->uuid);
+#endif
 
     // Keep the ProcessLauncher alive while we do the re-execing (balanced in event handler).
     that->ref();