[WPE] Pass the backend library name as command line parameter to the web process
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jul 2018 05:56:15 +0000 (05:56 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jul 2018 05:56:15 +0000 (05:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186841

Reviewed by Žan Doberšek.

Source/WebKit:

* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess): Add --backend-library parameter when launching the web process.
* WebProcess/wpe/WebProcessMainWPE.cpp: Call wpe_loader_init() with the library passed as --backend-library parameter.

Tools:

* MiniBrowser/wpe/main.cpp:
(main): Stop using WPE_BACKEND_LIBRARY env var.
* Scripts/run-wpe-tests:
(WPETestRunner.__init__): Ditto.
* Scripts/webkitpy/port/wpe.py:
(WPEPort.setup_environ_for_server): Ditto.
* wpe/backends/ViewBackend.cpp:
(WPEToolingBackends::ViewBackend::ViewBackend): Call wpe_loader_init() to ensure WPEBackend-fdo is used.
* wpe/jhbuild.modules: Upgrade WPEBackend to version 0.2.0.

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp
Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp
Tools/ChangeLog
Tools/MiniBrowser/wpe/main.cpp
Tools/Scripts/run-wpe-tests
Tools/Scripts/webkitpy/port/wpe.py
Tools/wpe/backends/ViewBackend.cpp
Tools/wpe/jhbuild.modules

index fb0b86d..17daac3 100644 (file)
@@ -1,3 +1,14 @@
+2018-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [WPE] Pass the backend library name as command line parameter to the web process
+        https://bugs.webkit.org/show_bug.cgi?id=186841
+
+        Reviewed by Žan Doberšek.
+
+        * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
+        (WebKit::ProcessLauncher::launchProcess): Add --backend-library parameter when launching the web process.
+        * WebProcess/wpe/WebProcessMainWPE.cpp: Call wpe_loader_init() with the library passed as --backend-library parameter.
+
 2018-07-11  Jon Lee  <jonlee@apple.com>
 
         Update iOS fullscreen alert text
index bebf0f7..ead3d1b 100644 (file)
@@ -99,7 +99,13 @@ void ProcessLauncher::launchProcess()
 
 #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++;
     }
@@ -127,8 +133,10 @@ void ProcessLauncher::launchProcess()
     argv[i++] = processIdentifier.get();
     argv[i++] = webkitSocket.get();
 #if PLATFORM(WPE)
-    if (m_launchOptions.processType == ProcessLauncher::ProcessType::Web)
+    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());
index 8e7766e..8b72e63 100644 (file)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include <iostream>
 #include <libsoup/soup.h>
+#include <wpe/wpe.h>
 
 using namespace WebCore;
 
@@ -56,14 +57,18 @@ public:
 
     bool parseCommandLine(int argc, char** argv) override
     {
-        ASSERT(argc == 4);
-        if (argc < 4)
+        ASSERT(argc == 5);
+        if (argc < 5)
             return false;
 
         if (!ChildProcessMainBase::parseCommandLine(argc, argv))
             return false;
 
-        int wpeFd = atoi(argv[3]);
+#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<PlatformDisplayWPE>(PlatformDisplay::sharedDisplay()));
index 096ed3f..d2e35de 100644 (file)
@@ -1,5 +1,22 @@
 2018-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [WPE] Pass the backend library name as command line parameter to the web process
+        https://bugs.webkit.org/show_bug.cgi?id=186841
+
+        Reviewed by Žan Doberšek.
+
+        * MiniBrowser/wpe/main.cpp:
+        (main): Stop using WPE_BACKEND_LIBRARY env var.
+        * Scripts/run-wpe-tests:
+        (WPETestRunner.__init__): Ditto.
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort.setup_environ_for_server): Ditto.
+        * wpe/backends/ViewBackend.cpp:
+        (WPEToolingBackends::ViewBackend::ViewBackend): Call wpe_loader_init() to ensure WPEBackend-fdo is used.
+        * wpe/jhbuild.modules: Upgrade WPEBackend to version 0.2.0.
+
+2018-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [GLIB] Add API to allow creating variadic functions
         https://bugs.webkit.org/show_bug.cgi?id=187517
 
index 00dd49e..a490c4b 100644 (file)
@@ -101,9 +101,6 @@ static std::unique_ptr<WPEToolingBackends::ViewBackend> createViewBackend(uint32
 
 int main(int argc, char *argv[])
 {
-    // MiniBrowser only works with WPEBackend-fdo, so ensure no other backend is used,
-    // either by passing the WPE_BACKEND_LIBRARY env var or loading the default symlink.
-    g_setenv("WPE_BACKEND_LIBRARY", "libWPEBackend-fdo-0.1.so", TRUE);
 #if ENABLE_DEVELOPER_MODE
     g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
 #endif
index bf69994..5c682f8 100755 (executable)
@@ -36,10 +36,6 @@ class WPETestRunner(TestRunner):
     def __init__(self, options, tests=[]):
         super(WPETestRunner, self).__init__("wpe", options, tests)
 
-    def _setup_testing_environment(self):
-        super(WPETestRunner, self)._setup_testing_environment()
-        self._test_env["WPE_BACKEND_LIBRARY"] = "libWPEBackend-fdo-0.1.so"
-
     def is_glib_test(self, test_program):
         return os.path.basename(os.path.dirname(test_program)) in ["WPE", "JavaScriptCore"]
 
index bacba5f..9a06561 100644 (file)
@@ -70,7 +70,6 @@ class WPEPort(Port):
 
     def setup_environ_for_server(self, server_name=None):
         environment = super(WPEPort, self).setup_environ_for_server(server_name)
-        environment['WPE_BACKEND_LIBRARY'] = 'libWPEBackend-fdo-0.1.so'
         environment['G_DEBUG'] = 'fatal-criticals'
         environment['GSETTINGS_BACKEND'] = 'memory'
         environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so')
index 28027a2..048faf0 100644 (file)
@@ -35,6 +35,9 @@ ViewBackend::ViewBackend(uint32_t width, uint32_t height)
     : m_width(width)
     , m_height(height)
 {
+#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(0, 2, 0)
+    wpe_loader_init("libWPEBackend-fdo-0.1.so");
+#endif
 }
 
 ViewBackend::~ViewBackend()
index f08621c..44910c1 100644 (file)
 
   <cmake id="wpebackend">
     <branch repo="github.com" module="WebPlatformForEmbedded/WPEBackend.git"
-            tag="761496dff51b6962200294b4fe2bc9529da731a8" />
+            tag="411decf4875e7a5c858489206cdb7705a4bbb581" />
   </cmake>
 
   <cmake id="wpebackend-fdo">