Title: [226327] trunk/Source/WebKit
Revision
226327
Author
mcatanz...@igalia.com
Date
2018-01-02 10:17:12 -0800 (Tue, 02 Jan 2018)

Log Message

[WPE][GTK] Implement the assignment of ProcessIdentifiers to child processes
https://bugs.webkit.org/show_bug.cgi?id=181187

Reviewed by Brady Eidson.

* Shared/ChildProcess.cpp: Make the ProcessIdentifier mandatory.
(WebKit::ChildProcess::initialize):
* Shared/unix/ChildProcessMain.cpp: Initialize ChildProcessInitializationParameters with the
ProcessIdentifier.
(WebKit::ChildProcessMainBase::parseCommandLine):
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: Copy the ProcessIdentifier from
LaunchOptions into argv.
(WebKit::ProcessLauncher::launchProcess):
* WebProcess/wpe/WebProcessMainWPE.cpp: Expect the WPE socket ID later in the command line.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (226326 => 226327)


--- trunk/Source/WebKit/ChangeLog	2018-01-02 18:17:07 UTC (rev 226326)
+++ trunk/Source/WebKit/ChangeLog	2018-01-02 18:17:12 UTC (rev 226327)
@@ -1,3 +1,20 @@
+2018-01-02  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [WPE][GTK] Implement the assignment of ProcessIdentifiers to child processes
+        https://bugs.webkit.org/show_bug.cgi?id=181187
+
+        Reviewed by Brady Eidson.
+
+        * Shared/ChildProcess.cpp: Make the ProcessIdentifier mandatory.
+        (WebKit::ChildProcess::initialize):
+        * Shared/unix/ChildProcessMain.cpp: Initialize ChildProcessInitializationParameters with the
+        ProcessIdentifier.
+        (WebKit::ChildProcessMainBase::parseCommandLine):
+        * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: Copy the ProcessIdentifier from
+        LaunchOptions into argv.
+        (WebKit::ProcessLauncher::launchProcess):
+        * WebProcess/wpe/WebProcessMainWPE.cpp: Expect the WPE socket ID later in the command line.
+
 2018-01-02  Alex Christensen  <achristen...@webkit.org>
 
         Use new WebsiteDataStore passed in through decidePolicyForNavigation SPI

Modified: trunk/Source/WebKit/Shared/ChildProcess.cpp (226326 => 226327)


--- trunk/Source/WebKit/Shared/ChildProcess.cpp	2018-01-02 18:17:07 UTC (rev 226326)
+++ trunk/Source/WebKit/Shared/ChildProcess.cpp	2018-01-02 18:17:12 UTC (rev 226327)
@@ -64,17 +64,9 @@
 
 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
+    RELEASE_ASSERT_WITH_MESSAGE(parameters.processIdentifier, "Unable to initialize child process without a WebCore process identifier");
+    Process::setIdentifier(*parameters.processIdentifier);
 
-    if (parameters.processIdentifier)
-        Process::setIdentifier(*parameters.processIdentifier);
-
     platformInitialize();
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit/Shared/unix/ChildProcessMain.cpp (226326 => 226327)


--- trunk/Source/WebKit/Shared/unix/ChildProcessMain.cpp	2018-01-02 18:17:07 UTC (rev 226326)
+++ trunk/Source/WebKit/Shared/unix/ChildProcessMain.cpp	2018-01-02 18:17:12 UTC (rev 226327)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ChildProcessMain.h"
 
+#include <WebCore/Process.h>
 #include <stdlib.h>
 
 namespace WebKit {
@@ -32,11 +33,12 @@
 
 bool ChildProcessMainBase::parseCommandLine(int argc, char** argv)
 {
-    ASSERT(argc >= 2);
-    if (argc < 2)
+    ASSERT(argc >= 3);
+    if (argc < 3)
         return false;
 
-    m_parameters.connectionIdentifier = atoi(argv[1]);
+    m_parameters.processIdentifier = makeObjectIdentifier<WebCore::ProcessIdentifierType>(atoll(argv[1]));
+    m_parameters.connectionIdentifier = atoi(argv[2]);
     return true;
 }
 

Modified: trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp (226326 => 226327)


--- trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp	2018-01-02 18:17:07 UTC (rev 226326)
+++ trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp	2018-01-02 18:17:12 UTC (rev 226327)
@@ -94,8 +94,9 @@
     }
 
     realExecutablePath = FileSystem::fileSystemRepresentation(executablePath);
+    GUniquePtr<gchar> processIdentifier(g_strdup_printf("%" PRIu64, m_launchOptions.processIdentifier.toUInt64()));
     GUniquePtr<gchar> webkitSocket(g_strdup_printf("%d", socketPair.client));
-    unsigned nargs = 4; // size of the argv array for g_spawn_async()
+    unsigned nargs = 5; // size of the argv array for g_spawn_async()
 
 #if PLATFORM(WPE)
     GUniquePtr<gchar> wpeSocket;
@@ -124,6 +125,7 @@
         argv[i++] = const_cast<char*>(arg.data());
 #endif
     argv[i++] = const_cast<char*>(realExecutablePath.data());
+    argv[i++] = processIdentifier.get();
     argv[i++] = webkitSocket.get();
 #if PLATFORM(WPE)
     if (m_launchOptions.processType == ProcessLauncher::ProcessType::Web)

Modified: trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp (226326 => 226327)


--- trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2018-01-02 18:17:07 UTC (rev 226326)
+++ trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2018-01-02 18:17:12 UTC (rev 226327)
@@ -52,14 +52,14 @@
 
     bool parseCommandLine(int argc, char** argv) override
     {
-        ASSERT(argc == 3);
-        if (argc < 3)
+        ASSERT(argc == 4);
+        if (argc < 4)
             return false;
 
         if (!ChildProcessMainBase::parseCommandLine(argc, argv))
             return false;
 
-        int wpeFd = atoi(argv[2]);
+        int wpeFd = atoi(argv[3]);
         RunLoop::main().dispatch(
             [wpeFd] {
                 RELEASE_ASSERT(is<PlatformDisplayWPE>(PlatformDisplay::sharedDisplay()));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to