Add a ProcessIdentifier, vended from the UI process, to each child process
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Dec 2017 05:56:29 +0000 (05:56 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Dec 2017 05:56:29 +0000 (05:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181155

Reviewed by Brent Fulgham.

Source/WebCore:

No new tests (Not yet testable)

More than once we've needed to create an identifier for an object that is unique across
all processes no matter which process it came from.

Sometimes we have an object or proxy object to the UI, Storage, or Network process
that allows us to augment a process-unique identifier to be globally unique. Due to multiple
sessions even this isn't good enough. Other times we have to create more hair-brained solutions.

In upcoming MessagePort work (Next step is https://bugs.webkit.org/show_bug.cgi?id=181172)
there was no truly workable solution for this.

By introducing a new ProcessIdentifier to each WK2 child processes that is guaranteed to be
unique over the run of a given UI process, we can easily create an object in any process and
identify it uniquely across all processes.

Obviously "process identifier" brings to mind a processes PID but that isn't good enough.
The number of PIDs on the system is fairly low and they are global across all
processes on the system. It is easy to see how a given UI process that runs for long enough
(such as a web browser that the user rarely quits) will start to run in to recycled PIDs,
therefore breaking the uniqueness guarantee that is required.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/Process.cpp: Added.
(WebCore::Process::setIdentifier): Sets the process-wise identifier (to be used during WK2
  child process initialization)
(WebCore::Process::identifier): Get the process-wide identifier.
* platform/Process.h: Added.

Source/WebKit:

* Shared/ChildProcess.cpp:
(WebKit::ChildProcess::initialize): Set the process-wide identifier if the initialization
  parameters have it. Cocoa ASSERTS it exists; non-Cocoa platforms will have to figure this
  out soon.
* Shared/ChildProcess.h:

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getProcessIdentifier):

* UIProcess/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::getLaunchOptions):
* UIProcess/ChildProcessProxy.h:
(WebKit::ChildProcessProxy::coreProcessIdentifier const):

* UIProcess/Launcher/ProcessLauncher.h:
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):

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

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/Process.cpp [new file with mode: 0644]
Source/WebCore/platform/Process.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Shared/ChildProcess.cpp
Source/WebKit/Shared/ChildProcess.h
Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h
Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm
Source/WebKit/UIProcess/ChildProcessProxy.cpp
Source/WebKit/UIProcess/ChildProcessProxy.h
Source/WebKit/UIProcess/Launcher/ProcessLauncher.h
Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm

index f506355..3899b2d 100644 (file)
@@ -1,3 +1,40 @@
+2017-12-28  Brady Eidson  <beidson@apple.com>
+
+        Add a ProcessIdentifier, vended from the UI process, to each child process
+        https://bugs.webkit.org/show_bug.cgi?id=181155
+
+        Reviewed by Brent Fulgham.
+
+        No new tests (Not yet testable)
+
+        More than once we've needed to create an identifier for an object that is unique across
+        all processes no matter which process it came from.
+        
+        Sometimes we have an object or proxy object to the UI, Storage, or Network process
+        that allows us to augment a process-unique identifier to be globally unique. Due to multiple
+        sessions even this isn't good enough. Other times we have to create more hair-brained solutions.
+        
+        In upcoming MessagePort work (Next step is https://bugs.webkit.org/show_bug.cgi?id=181172)
+        there was no truly workable solution for this.
+        
+        By introducing a new ProcessIdentifier to each WK2 child processes that is guaranteed to be 
+        unique over the run of a given UI process, we can easily create an object in any process and
+        identify it uniquely across all processes.
+        
+        Obviously "process identifier" brings to mind a processes PID but that isn't good enough.
+        The number of PIDs on the system is fairly low and they are global across all
+        processes on the system. It is easy to see how a given UI process that runs for long enough
+        (such as a web browser that the user rarely quits) will start to run in to recycled PIDs, 
+        therefore breaking the uniqueness guarantee that is required.
+        
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/Process.cpp: Added.
+        (WebCore::Process::setIdentifier): Sets the process-wise identifier (to be used during WK2
+          child process initialization)
+        (WebCore::Process::identifier): Get the process-wide identifier.
+        * platform/Process.h: Added.
+
 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
index 5f225a9..7f6b837 100644 (file)
@@ -1431,6 +1431,7 @@ platform/PlatformSpeechSynthesisUtterance.cpp
 platform/PlatformSpeechSynthesisVoice.cpp
 platform/PlatformSpeechSynthesizer.cpp
 platform/PlatformStrategies.cpp
+platform/Process.cpp
 platform/RemoteCommandListener.cpp
 platform/RuntimeApplicationChecks.cpp
 platform/SchemeRegistry.cpp
index 52266cc..43bb4b5 100644 (file)
                51F645691F4539B900B54DED /* ServiceWorkerJobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645661F45399F00B54DED /* ServiceWorkerJobData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F6456A1F4539C000B54DED /* ServiceWorkerJobType.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645651F45399F00B54DED /* ServiceWorkerJobType.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F645971F4A686F00B54DED /* SWServerRegistration.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645941F4A684F00B54DED /* SWServerRegistration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               51F645D51FECDBCE00B54DED /* Process.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F645D31FECDBC800B54DED /* Process.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F886C01F32923100C193EF /* JSNavigatorServiceWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F886BF1F32920700C193EF /* JSNavigatorServiceWorker.h */; };
                51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 517FBA18151AA71B00B57959 /* DOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F645951F4A686100B54DED /* SWServerRegistration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWServerRegistration.cpp; sourceTree = "<group>"; };
                51F645A01F4BF51600B54DED /* ServiceWorkerRegistrationOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationOptions.cpp; sourceTree = "<group>"; };
                51F645A31F4C000C00B54DED /* ExceptionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionData.cpp; sourceTree = "<group>"; };
+               51F645D21FECDBC800B54DED /* Process.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Process.cpp; sourceTree = "<group>"; };
+               51F645D31FECDBC800B54DED /* Process.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Process.h; sourceTree = "<group>"; };
                51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLCanvasElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51F798EB1BE880D3008AE491 /* IDBIndexInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexInfo.cpp; sourceTree = "<group>"; };
                                0668E1890ADD9624004128E0 /* PopupMenu.h */,
                                ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */,
                                BC3BE12A0E98092F00835588 /* PopupMenuStyle.h */,
+                               51F645D21FECDBC800B54DED /* Process.cpp */,
+                               51F645D31FECDBC800B54DED /* Process.h */,
                                0081FEFD16B0A244008AAA7A /* PublicSuffix.h */,
                                5C97A3361F5F7A6500105207 /* RectEdges.h */,
                                9831AE49154225A200FE2644 /* ReferrerPolicy.h */,
                                A185B42A1E8211A100DC9118 /* PreviewLoader.h in Headers */,
                                A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */,
                                B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
+                               51F645D51FECDBCE00B54DED /* Process.h in Headers */,
                                A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */,
                                E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */,
                                A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */,
diff --git a/Source/WebCore/platform/Process.cpp b/Source/WebCore/platform/Process.cpp
new file mode 100644 (file)
index 0000000..843d036
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Process.h"
+
+#include <wtf/Lock.h>
+#include <wtf/Locker.h>
+#include <wtf/MainThread.h>
+
+namespace WebCore {
+namespace Process {
+
+static std::optional<ProcessIdentifier> globalIdentifier;
+static Lock globalIdentifierLock;
+
+void setIdentifier(ProcessIdentifier processIdentifier)
+{
+    ASSERT(isMainThread());
+    Locker<Lock> locker(globalIdentifierLock);
+    globalIdentifier = processIdentifier;
+}
+
+ProcessIdentifier identifier()
+{
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        Locker<Lock> locker(globalIdentifierLock);
+        if (!globalIdentifier)
+            globalIdentifier = generateObjectIdentifier<ProcessIdentifierType>();
+    });
+
+    Locker<Lock> locker(globalIdentifierLock);
+    return *globalIdentifier;
+}
+
+} // namespace Process
+} // namespace WebCore
diff --git a/Source/WebCore/platform/Process.h b/Source/WebCore/platform/Process.h
new file mode 100644 (file)
index 0000000..3e10009
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebCore {
+
+enum ProcessIdentifierType { };
+using ProcessIdentifier = ObjectIdentifier<ProcessIdentifierType>;
+
+namespace Process {
+
+WEBCORE_EXPORT void setIdentifier(ProcessIdentifier);
+WEBCORE_EXPORT ProcessIdentifier identifier();
+
+} // namespace Process
+} // namespace WebCore
index 68f72e4..4e9d210 100644 (file)
@@ -1,3 +1,30 @@
+2017-12-28  Brady Eidson  <beidson@apple.com>
+
+        Add a ProcessIdentifier, vended from the UI process, to each child process
+        https://bugs.webkit.org/show_bug.cgi?id=181155
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/ChildProcess.cpp:
+        (WebKit::ChildProcess::initialize): Set the process-wide identifier if the initialization
+          parameters have it. Cocoa ASSERTS it exists; non-Cocoa platforms will have to figure this
+          out soon.
+        * Shared/ChildProcess.h:
+
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
+        (WebKit::XPCServiceInitializer):
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::XPCServiceInitializerDelegate::getProcessIdentifier):
+
+        * UIProcess/ChildProcessProxy.cpp:
+        (WebKit::ChildProcessProxy::getLaunchOptions):
+        * UIProcess/ChildProcessProxy.h:
+        (WebKit::ChildProcessProxy::coreProcessIdentifier const):
+
+        * UIProcess/Launcher/ProcessLauncher.h:
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::ProcessLauncher::launchProcess):
+
 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
index 5b0b5d7..298eaa7 100644 (file)
@@ -32,6 +32,8 @@
 #include <pal/SessionID.h>
 #include <unistd.h>
 
+using namespace WebCore;
+
 namespace WebKit {
 
 ChildProcess::ChildProcess()
@@ -62,6 +64,17 @@ static void didCloseOnConnectionWorkQueue(IPC::Connection*)
 
 void ChildProcess::initialize(const ChildProcessInitializationParameters& parameters)
 {
+#if PLATFORM(COCOA)
+    if (!parameters.processIdentifier)
+        RELEASE_ASSERT_WITH_MESSAGE(false, "Unable to initialize child process without a WebCore process identifier");
+#else
+    if (!parameters.processIdentifier)
+        LOG_ERROR("All child processes should have a WebCore::ProcessIdentifier vended by the UI process, but this one doesn't. This will cause things to break.");
+#endif
+
+    if (parameters.processIdentifier)
+        Process::setIdentifier(*parameters.processIdentifier);
+
     platformInitialize();
 
 #if PLATFORM(COCOA)
index ce98d73..151f327 100644 (file)
@@ -29,6 +29,7 @@
 #include "Connection.h"
 #include "MessageReceiverMap.h"
 #include "MessageSender.h"
+#include <WebCore/Process.h>
 #include <WebCore/UserActivity.h>
 #include <wtf/HashMap.h>
 #include <wtf/RunLoop.h>
@@ -42,6 +43,7 @@ class SandboxInitializationParameters;
 struct ChildProcessInitializationParameters {
     String uiProcessName;
     String clientIdentifier;
+    std::optional<WebCore::ProcessIdentifier> processIdentifier;
     IPC::Connection::Identifier connectionIdentifier;
     HashMap<String, String> extraInitializationData;
 #if PLATFORM(COCOA)
index f23db43..75828fd 100644 (file)
@@ -54,6 +54,7 @@ public:
     virtual bool checkEntitlements();
 
     virtual bool getConnectionIdentifier(IPC::Connection::Identifier& identifier);
+    virtual bool getProcessIdentifier(WebCore::ProcessIdentifier&);
     virtual bool getClientIdentifier(String& clientIdentifier);
     virtual bool getClientProcessName(String& clientProcessName);
     virtual bool getExtraInitializationData(HashMap<String, String>& extraInitializationData);
@@ -90,6 +91,11 @@ void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_
     if (!delegate.getClientIdentifier(parameters.clientIdentifier))
         exit(EXIT_FAILURE);
 
+    WebCore::ProcessIdentifier processIdentifier;
+    if (!delegate.getProcessIdentifier(processIdentifier))
+        exit(EXIT_FAILURE);
+    parameters.processIdentifier = processIdentifier;
+
     if (!delegate.getClientProcessName(parameters.uiProcessName))
         exit(EXIT_FAILURE);
 
index d46d8a2..95e29ea 100644 (file)
@@ -28,6 +28,9 @@
 #import "ArgumentCodersCF.h"
 #import "SandboxUtilities.h"
 #import "XPCServiceEntryPoint.h"
+#import <WebCore/Process.h>
+
+using namespace WebCore;
 
 namespace WebKit {
 
@@ -81,6 +84,21 @@ bool XPCServiceInitializerDelegate::getClientIdentifier(String& clientIdentifier
     return true;
 }
 
+bool XPCServiceInitializerDelegate::getProcessIdentifier(ProcessIdentifier& identifier)
+{
+    String processIdentifierString = xpc_dictionary_get_string(m_initializerMessage, "process-identifier");
+    if (processIdentifierString.isEmpty())
+        return false;
+
+    bool ok;
+    auto parsedIdentifier = processIdentifierString.toUInt64Strict(&ok);
+    if (!ok)
+        return false;
+
+    identifier = makeObjectIdentifier<ProcessIdentifierType>(parsedIdentifier);
+    return true;
+}
+
 bool XPCServiceInitializerDelegate::getClientProcessName(String& clientProcessName)
 {
     clientProcessName = xpc_dictionary_get_string(m_initializerMessage, "ui-process-name");
index a6e4d8a..5a8e3b0 100644 (file)
@@ -49,6 +49,8 @@ ChildProcessProxy::~ChildProcessProxy()
 
 void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
 {
+    launchOptions.processIdentifier = m_processIdentifier;
+
     if (const char* userDirectorySuffix = getenv("DIRHELPER_USER_DIR_SUFFIX"))
         launchOptions.extraInitializationData.add(ASCIILiteral("user-directory-suffix"), userDirectorySuffix);
 
index 7b31c8e..6d4802f 100644 (file)
@@ -29,6 +29,7 @@
 #include "MessageReceiverMap.h"
 #include "ProcessLauncher.h"
 
+#include <WebCore/Process.h>
 #include <wtf/ProcessID.h>
 #include <wtf/SystemTracing.h>
 #include <wtf/ThreadSafeRefCounted.h>
@@ -80,6 +81,8 @@ public:
 
     void shutDownProcess();
 
+    WebCore::ProcessIdentifier coreProcessIdentifier() const { return m_processIdentifier; }
+
 protected:
     // ProcessLauncher::Client
     void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
@@ -98,6 +101,7 @@ private:
     RefPtr<IPC::Connection> m_connection;
     IPC::MessageReceiverMap m_messageReceiverMap;
     bool m_alwaysRunsAtBackgroundPriority { false };
+    WebCore::ProcessIdentifier m_processIdentifier { generateObjectIdentifier<WebCore::ProcessIdentifierType>() };
 };
 
 template<typename T>
index 022ab6a..30bebf3 100644 (file)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "Connection.h"
+#include <WebCore/Process.h>
 #include <wtf/HashMap.h>
 #include <wtf/ProcessID.h>
 #include <wtf/RefPtr.h>
@@ -57,6 +58,7 @@ public:
 
     struct LaunchOptions {
         ProcessType processType;
+        WebCore::ProcessIdentifier processIdentifier;
         HashMap<String, String> extraInitializationData;
 
 #if ENABLE(DEVELOPER_MODE) && (PLATFORM(GTK) || PLATFORM(WPE))
index 2db6ba4..f8420f6 100644 (file)
@@ -175,6 +175,7 @@ void ProcessLauncher::launchProcess()
     mach_port_deallocate(mach_task_self(), listeningPort);
 
     xpc_dictionary_set_string(bootstrapMessage.get(), "client-identifier", !clientIdentifier.isEmpty() ? clientIdentifier.utf8().data() : *_NSGetProgname());
+    xpc_dictionary_set_string(bootstrapMessage.get(), "process-identifier", String::number(m_launchOptions.processIdentifier.toUInt64()).utf8().data());
     xpc_dictionary_set_string(bootstrapMessage.get(), "ui-process-name", [[[NSProcessInfo processInfo] processName] UTF8String]);
 
     bool isWebKitDevelopmentBuild = ![[[[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] bundlePath] stringByDeletingLastPathComponent] hasPrefix:systemDirectoryPath()];