From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp | 37 +++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'Source/WebKit2/UIProcess/Launcher/gtk') diff --git a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp index 89d367c77..add147995 100644 --- a/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp +++ b/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp @@ -38,10 +38,11 @@ #include #include #include +#include +#include +#include #include #include -#include -#include using namespace WebCore; @@ -62,18 +63,28 @@ void ProcessLauncher::launchProcess() String executablePath, pluginPath; CString realExecutablePath, realPluginPath; switch (m_launchOptions.processType) { - case WebProcess: + case ProcessLauncher::ProcessType::Web: executablePath = executablePathOfWebProcess(); break; - case PluginProcess: +#if ENABLE(NETSCAPE_PLUGIN_API) + case ProcessLauncher::ProcessType::Plugin64: + case ProcessLauncher::ProcessType::Plugin32: executablePath = executablePathOfPluginProcess(); +#if ENABLE(PLUGIN_PROCESS_GTK2) + if (m_launchOptions.extraInitializationData.contains("requires-gtk2")) + executablePath.append('2'); +#endif pluginPath = m_launchOptions.extraInitializationData.get("plugin-path"); realPluginPath = fileSystemRepresentation(pluginPath); break; -#if ENABLE(NETWORK_PROCESS) - case NetworkProcess: +#endif + case ProcessLauncher::ProcessType::Network: executablePath = executablePathOfNetworkProcess(); break; +#if ENABLE(DATABASE_PROCESS) + case ProcessLauncher::ProcessType::Database: + executablePath = executablePathOfDatabaseProcess(); + break; #endif default: ASSERT_NOT_REACHED(); @@ -85,7 +96,7 @@ void ProcessLauncher::launchProcess() unsigned nargs = 4; // size of the argv array for g_spawn_async() -#ifndef NDEBUG +#if ENABLE(DEVELOPER_MODE) Vector prefixArgs; if (!m_launchOptions.processCmdPrefix.isNull()) { Vector splitArgs; @@ -98,7 +109,7 @@ void ProcessLauncher::launchProcess() char** argv = g_newa(char*, nargs); unsigned i = 0; -#ifndef NDEBUG +#if ENABLE(DEVELOPER_MODE) // If there's a prefix command, put it before the rest of the args. for (auto it = prefixArgs.begin(); it != prefixArgs.end(); it++) argv[i++] = const_cast(it->data()); @@ -115,14 +126,18 @@ void ProcessLauncher::launchProcess() } // Don't expose the parent socket to potential future children. - while (fcntl(socketPair.client, F_SETFD, FD_CLOEXEC) == -1) - RELEASE_ASSERT(errno != EINTR); + if (!setCloseOnExec(socketPair.client)) + RELEASE_ASSERT_NOT_REACHED(); close(socketPair.client); m_processIdentifier = pid; // We've finished launching the process, message back to the main run loop. - RunLoop::main()->dispatch(bind(&ProcessLauncher::didFinishLaunchingProcess, this, m_processIdentifier, socketPair.server)); + RefPtr protector(this); + IPC::Connection::Identifier serverSocket = socketPair.server; + RunLoop::main().dispatch([protector, pid, serverSocket] { + protector->didFinishLaunchingProcess(pid, serverSocket); + }); } void ProcessLauncher::terminateProcess() -- cgit v1.2.1