Skip to content

Commit

Permalink
Merge r241816 - [WPE] Send client host fd and library name as web pro…
Browse files Browse the repository at this point in the history
…cess 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:
  • Loading branch information
carlosgcampos committed Mar 5, 2019
1 parent 7fd379a commit 246f715
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 50 deletions.
22 changes: 22 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,25 @@
2019-02-20 Carlos Garcia Campos <cgarcia@igalia.com>

[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 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Epiphany searching for plugins even if plugins are disabled
Expand Down
12 changes: 12 additions & 0 deletions Source/WebKit/Shared/WebProcessCreationParameters.cpp
Expand Up @@ -159,6 +159,11 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
encoder << screenProperties;
encoder << useOverlayScrollbars;
#endif

#if PLATFORM(WPE)
encoder << hostClientFileDescriptor;
encoder << implementationLibraryName;
#endif
}

bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreationParameters& parameters)
Expand Down Expand Up @@ -421,6 +426,13 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
return false;
#endif

#if PLATFORM(WPE)
if (!decoder.decode(parameters.hostClientFileDescriptor))
return false;
if (!decoder.decode(parameters.implementationLibraryName))
return false;
#endif

return true;
}

Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit/Shared/WebProcessCreationParameters.h
Expand Up @@ -198,6 +198,11 @@ struct WebProcessCreationParameters {
WebCore::ScreenProperties screenProperties;
bool useOverlayScrollbars { true };
#endif

#if PLATFORM(WPE)
IPC::Attachment hostClientFileDescriptor;
CString implementationLibraryName;
#endif
};

} // namespace WebKit
24 changes: 0 additions & 24 deletions Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp
Expand Up @@ -40,10 +40,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)
Expand Down Expand Up @@ -91,20 +87,6 @@ void ProcessLauncher::launchProcess()
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()) {
Expand All @@ -124,12 +106,6 @@ void ProcessLauncher::launchProcess()
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
Expand Down
12 changes: 12 additions & 0 deletions Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp
Expand Up @@ -32,8 +32,13 @@
#include "WebProcessCreationParameters.h"
#include <JavaScriptCore/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)
Expand Down Expand Up @@ -83,6 +88,13 @@ void WebProcessPool::platformInitialize()

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;

Expand Down
12 changes: 12 additions & 0 deletions Source/WebKit/WebProcess/glib/WebProcessGLib.cpp
Expand Up @@ -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)
Expand All @@ -44,6 +49,13 @@ void WebProcess::platformSetCacheModel(CacheModel cacheModel)

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
Expand Down
26 changes: 0 additions & 26 deletions Source/WebKit/WebProcess/wpe/WebProcessMainWPE.cpp
Expand Up @@ -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;
Expand All @@ -53,28 +49,6 @@ class WebProcessMain final : public AuxiliaryProcessMainBase {

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)
Expand Down

0 comments on commit 246f715

Please sign in to comment.