Title: [158105] trunk/Source/WebKit2
- Revision
- 158105
- Author
- [email protected]
- Date
- 2013-10-28 03:36:28 -0700 (Mon, 28 Oct 2013)
Log Message
[WK2] [GTK] Allow running the web process with an arbitrary prefix command
https://bugs.webkit.org/show_bug.cgi?id=123201
Reviewed by Carlos Garcia Campos.
Launch the web process using WEB_PROCESS_CMD_PREFIX as a
prefix. Useful for debugging the web process with gdb, valgrind,
etc.
* UIProcess/Launcher/ProcessLauncher.h:
* UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/gtk/WebProcessProxyGtk.cpp:
(WebKit::WebProcessProxy::platformGetLaunchOptions):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (158104 => 158105)
--- trunk/Source/WebKit2/ChangeLog 2013-10-28 09:57:48 UTC (rev 158104)
+++ trunk/Source/WebKit2/ChangeLog 2013-10-28 10:36:28 UTC (rev 158105)
@@ -1,3 +1,20 @@
+2013-10-28 Alberto Garcia <[email protected]>
+
+ [WK2] [GTK] Allow running the web process with an arbitrary prefix command
+ https://bugs.webkit.org/show_bug.cgi?id=123201
+
+ Reviewed by Carlos Garcia Campos.
+
+ Launch the web process using WEB_PROCESS_CMD_PREFIX as a
+ prefix. Useful for debugging the web process with gdb, valgrind,
+ etc.
+
+ * UIProcess/Launcher/ProcessLauncher.h:
+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+ (WebKit::ProcessLauncher::launchProcess):
+ * UIProcess/gtk/WebProcessProxyGtk.cpp:
+ (WebKit::WebProcessProxy::platformGetLaunchOptions):
+
2013-10-27 Brady Eidson <[email protected]>
WebIconDatabase can miss private browsing state changes.
Modified: trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h (158104 => 158105)
--- trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h 2013-10-28 09:57:48 UTC (rev 158104)
+++ trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h 2013-10-28 10:36:28 UTC (rev 158105)
@@ -67,7 +67,7 @@
bool executableHeap;
bool useXPC;
#endif
-#if PLATFORM(EFL)
+#if PLATFORM(EFL) || PLATFORM(GTK)
#ifndef NDEBUG
String processCmdPrefix;
#endif
Modified: trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp (158104 => 158105)
--- trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp 2013-10-28 09:57:48 UTC (rev 158104)
+++ trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp 2013-10-28 10:36:28 UTC (rev 158105)
@@ -97,12 +97,32 @@
realExecutablePath = fileSystemRepresentation(executablePath);
GOwnPtr<gchar> socket(g_strdup_printf("%d", sockets[0]));
- char* argv[4];
- argv[0] = const_cast<char*>(realExecutablePath.data());
- argv[1] = socket.get();
- argv[2] = const_cast<char*>(realPluginPath.data());
- argv[3] = 0;
+ unsigned nargs = 4; // size of the argv array for g_spawn_async()
+
+#ifndef NDEBUG
+ Vector<CString> prefixArgs;
+ if (!m_launchOptions.processCmdPrefix.isNull()) {
+ Vector<String> splitArgs;
+ m_launchOptions.processCmdPrefix.split(' ', splitArgs);
+ for (auto it = splitArgs.begin(); it != splitArgs.end(); it++)
+ prefixArgs.append(it->utf8());
+ nargs += prefixArgs.size();
+ }
+#endif
+
+ char** argv = g_newa(char*, nargs);
+ unsigned i = 0;
+#ifndef NDEBUG
+ // 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<char*>(it->data());
+#endif
+ argv[i++] = const_cast<char*>(realExecutablePath.data());
+ argv[i++] = socket.get();
+ argv[i++] = const_cast<char*>(realPluginPath.data());
+ argv[i++] = 0;
+
GOwnPtr<GError> error;
if (!g_spawn_async(0, argv, 0, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, childSetupFunction, GINT_TO_POINTER(sockets[1]), &pid, &error.outPtr())) {
g_printerr("Unable to fork a new WebProcess: %s.\n", error->message);
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebProcessProxyGtk.cpp (158104 => 158105)
--- trunk/Source/WebKit2/UIProcess/gtk/WebProcessProxyGtk.cpp 2013-10-28 09:57:48 UTC (rev 158104)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebProcessProxyGtk.cpp 2013-10-28 10:36:28 UTC (rev 158105)
@@ -25,11 +25,19 @@
#include "config.h"
#include "WebProcessProxy.h"
+#include <glib.h>
namespace WebKit {
-void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions&)
+void WebProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
{
+#ifndef NDEBUG
+ const char* webProcessCmdPrefix = g_getenv("WEB_PROCESS_CMD_PREFIX");
+ if (webProcessCmdPrefix && *webProcessCmdPrefix)
+ launchOptions.processCmdPrefix = String::fromUTF8(webProcessCmdPrefix);
+#else
+ UNUSED_PARAM(launchOptions);
+#endif
}
} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes