Title: [241816] trunk/Source/WebKit
Revision
241816
Author
[email protected]
Date
2019-02-20 06:34:51 -0800 (Wed, 20 Feb 2019)

Log Message

[WPE] Send client host fd and library name as web process creation parameters
https://bugs.webkit.org/show_bug.cgi?id=194494

Reviewed by Žan Doberšek.

Instead of using command line arguments. The code is simpler and we don't need wpe specific code in process
launcher glib implementation.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess):
* WebProcess/wpe/WebProcessMainWPE.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241815 => 241816)


--- trunk/Source/WebKit/ChangeLog	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/ChangeLog	2019-02-20 14:34:51 UTC (rev 241816)
@@ -1,3 +1,25 @@
+2019-02-20  Carlos Garcia Campos  <[email protected]>
+
+        [WPE] Send client host fd and library name as web process creation parameters
+        https://bugs.webkit.org/show_bug.cgi?id=194494
+
+        Reviewed by Žan Doberšek.
+
+        Instead of using command line arguments. The code is simpler and we don't need wpe specific code in process
+        launcher glib implementation.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/glib/WebProcessGLib.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        * WebProcess/wpe/WebProcessMainWPE.cpp:
+
 2019-02-20  Adrian Perez de Castro  <[email protected]>
 
         [WPE][GTK] Enable support for CONTENT_EXTENSIONS

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (241815 => 241816)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-02-20 14:34:51 UTC (rev 241816)
@@ -159,6 +159,11 @@
     encoder << screenProperties;
     encoder << useOverlayScrollbars;
 #endif
+
+#if PLATFORM(WPE)
+    encoder << hostClientFileDescriptor;
+    encoder << implementationLibraryName;
+#endif
 }
 
 bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreationParameters& parameters)
@@ -421,6 +426,13 @@
         return false;
 #endif
 
+#if PLATFORM(WPE)
+    if (!decoder.decode(parameters.hostClientFileDescriptor))
+        return false;
+    if (!decoder.decode(parameters.implementationLibraryName))
+        return false;
+#endif
+
     return true;
 }
 

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (241815 => 241816)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-02-20 14:34:51 UTC (rev 241816)
@@ -198,6 +198,11 @@
     WebCore::ScreenProperties screenProperties;
     bool useOverlayScrollbars { true };
 #endif
+
+#if PLATFORM(WPE)
+    IPC::Attachment hostClientFileDescriptor;
+    CString implementationLibraryName;
+#endif
 };
 
 } // namespace WebKit

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


--- trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp	2019-02-20 14:34:51 UTC (rev 241816)
@@ -42,10 +42,6 @@
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
-#if PLATFORM(WPE)
-#include <wpe/wpe.h>
-#endif
-
 namespace WebKit {
 
 static void childSetupFunction(gpointer userData)
@@ -112,20 +108,6 @@
     GUniquePtr<gchar> webkitSocket(g_strdup_printf("%d", socketPair.client));
     unsigned nargs = 5; // size of the argv array for g_spawn_async()
 
-#if PLATFORM(WPE)
-    GUniquePtr<gchar> wpeSocket;
-    CString wpeBackendLibraryParameter;
-    if (m_launchOptions.processType == ProcessLauncher::ProcessType::Web) {
-#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(0, 2, 0)
-        wpeBackendLibraryParameter = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
-#endif
-        nargs++;
-
-        wpeSocket = GUniquePtr<gchar>(g_strdup_printf("%d", wpe_renderer_host_create_client()));
-        nargs++;
-    }
-#endif
-
 #if ENABLE(DEVELOPER_MODE)
     Vector<CString> prefixArgs;
     if (!m_launchOptions.processCmdPrefix.isNull()) {
@@ -145,12 +127,6 @@
     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) {
-        argv[i++] = const_cast<char*>(wpeBackendLibraryParameter.isNull() ? "-" : wpeBackendLibraryParameter.data());
-        argv[i++] = wpeSocket.get();
-    }
-#endif
 #if ENABLE(NETSCAPE_PLUGIN_API)
     argv[i++] = const_cast<char*>(realPluginPath.data());
 #else

Modified: trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp (241815 => 241816)


--- trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp	2019-02-20 14:34:51 UTC (rev 241816)
@@ -32,8 +32,13 @@
 #include "WebProcessCreationParameters.h"
 #include <_javascript_Core/RemoteInspectorServer.h>
 #include <WebCore/GStreamerCommon.h>
+#include <wtf/FileSystem.h>
 #include <wtf/glib/GUniquePtr.h>
 
+#if PLATFORM(WPE)
+#include <wpe/wpe.h>
+#endif
+
 namespace WebKit {
 
 #if ENABLE(REMOTE_INSPECTOR)
@@ -83,6 +88,13 @@
 
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
+#if PLATFORM(WPE)
+    parameters.hostClientFileDescriptor = wpe_renderer_host_create_client();
+#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(0, 2, 0)
+    parameters.implementationLibraryName = FileSystem::fileSystemRepresentation(wpe_loader_get_loaded_implementation_library_name());
+#endif
+#endif
+
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModel::DocumentViewer;
     parameters.proxySettings = m_networkProxySettings;
 

Modified: trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp (241815 => 241816)


--- trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-02-20 14:34:51 UTC (rev 241816)
@@ -35,6 +35,11 @@
 #include "WaylandCompositorDisplay.h"
 #endif
 
+#if PLATFORM(WPE)
+#include <WebCore/PlatformDisplayLibWPE.h>
+#include <wpe/wpe.h>
+#endif
+
 namespace WebKit {
 
 void WebProcess::platformSetCacheModel(CacheModel cacheModel)
@@ -44,6 +49,13 @@
 
 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& parameters)
 {
+#if PLATFORM(WPE)
+    auto& implementationLibraryName = parameters.implementationLibraryName;
+    if (!implementationLibraryName.isNull() && implementationLibraryName.data()[0] != '\0')
+        wpe_loader_init(parameters.implementationLibraryName.data());
+    RELEASE_ASSERT(is<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()));
+    downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).initialize(parameters.hostClientFileDescriptor.releaseFileDescriptor());
+#endif
 #if PLATFORM(WAYLAND)
     m_waylandCompositorDisplay = WaylandCompositorDisplay::create(parameters.waylandCompositorDisplayName);
 #endif

Modified: trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp (241815 => 241816)


--- trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2019-02-20 13:10:11 UTC (rev 241815)
+++ trunk/Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp	2019-02-20 14:34:51 UTC (rev 241816)
@@ -29,11 +29,7 @@
 
 #include "AuxiliaryProcessMain.h"
 #include "WebProcess.h"
-#include <WebCore/PlatformDisplayLibWPE.h>
 #include <glib.h>
-#include <iostream>
-#include <libsoup/soup.h>
-#include <wpe/wpe.h>
 
 namespace WebKit {
 using namespace WebCore;
@@ -53,28 +49,6 @@
 
         return true;
     }
-
-    bool parseCommandLine(int argc, char** argv) override
-    {
-        ASSERT(argc == 5);
-        if (argc < 5)
-            return false;
-
-        if (!AuxiliaryProcessMainBase::parseCommandLine(argc, argv))
-            return false;
-
-#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(0, 2, 0)
-        wpe_loader_init(argv[3]);
-#endif
-
-        int wpeFd = atoi(argv[4]);
-        RunLoop::main().dispatch(
-            [wpeFd] {
-                RELEASE_ASSERT(is<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()));
-                downcast<PlatformDisplayLibWPE>(PlatformDisplay::sharedDisplay()).initialize(wpeFd);
-            });
-        return true;
-    }
 };
 
 int WebProcessMainUnix(int argc, char** argv)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to