Title: [127967] trunk/Source/WebKit2
- Revision
- 127967
- Author
- [email protected]
- Date
- 2012-09-08 03:50:37 -0700 (Sat, 08 Sep 2012)
Log Message
[Qt] Fix CoreIPC setup between ProcessLauncher and WebProcessMain on Windows
https://bugs.webkit.org/show_bug.cgi?id=96179
Patch by Simon Hausmann <[email protected]> on 2012-09-08
Reviewed by Kenneth Rohde Christiansen.
* UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
(WebKit::ProcessLauncher::launchProcess): Hide Unixy platform specific code
and includes behind appropriate platform #ifdefs and use
CoreIPC::Connection::createServerAndClientIdentifiers to set up the IPC pipes.
We also need to tell Windows about our intent of using the client handle in
the child web process.
* WebProcess/qt/WebProcessMainQt.cpp:
(WebKit::WebProcessMainQt): After retrieving the IPC identifier we call
WebKit::WebProcess::shared().initialize with it. That function actually
cares a CIPC::Connection::Identifier as argument, which happens to be an
int on Unix, but it's actually a HANDLE on Windows. Change the parameter
type according to and a reinterpret_cast from the converted unsigned integer,
similar to WebProcessMainWin.cpp.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (127966 => 127967)
--- trunk/Source/WebKit2/ChangeLog 2012-09-08 10:48:09 UTC (rev 127966)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-08 10:50:37 UTC (rev 127967)
@@ -1,3 +1,24 @@
+2012-09-08 Simon Hausmann <[email protected]>
+
+ [Qt] Fix CoreIPC setup between ProcessLauncher and WebProcessMain on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=96179
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
+ (WebKit::ProcessLauncher::launchProcess): Hide Unixy platform specific code
+ and includes behind appropriate platform #ifdefs and use
+ CoreIPC::Connection::createServerAndClientIdentifiers to set up the IPC pipes.
+ We also need to tell Windows about our intent of using the client handle in
+ the child web process.
+ * WebProcess/qt/WebProcessMainQt.cpp:
+ (WebKit::WebProcessMainQt): After retrieving the IPC identifier we call
+ WebKit::WebProcess::shared().initialize with it. That function actually
+ cares a CIPC::Connection::Identifier as argument, which happens to be an
+ int on Unix, but it's actually a HANDLE on Windows. Change the parameter
+ type according to and a reinterpret_cast from the converted unsigned integer,
+ similar to WebProcessMainWin.cpp.
+
2012-09-08 Christophe Dumez <[email protected]>
[WK2] New fast/events/tab-focus-link-in-canvas fails from r126908
Modified: trunk/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp (127966 => 127967)
--- trunk/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp 2012-09-08 10:48:09 UTC (rev 127966)
+++ trunk/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp 2012-09-08 10:50:37 UTC (rev 127967)
@@ -38,6 +38,12 @@
#include <QtCore/qglobal.h>
#include <WebCore/NotImplemented.h>
#include <WebCore/RunLoop.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+#include <wtf/text/WTFString.h>
+
+#if defined(Q_OS_UNIX)
#include <errno.h>
#include <fcntl.h>
#include <runtime/InitializeThreading.h>
@@ -45,16 +51,17 @@
#include <sys/resource.h>
#include <sys/socket.h>
#include <unistd.h>
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
-#include <wtf/text/WTFString.h>
+#endif
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
#include <signal.h>
#endif
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
#if OS(DARWIN)
#include <mach/mach_init.h>
#include <servers/bootstrap.h>
@@ -127,6 +134,15 @@
ASSERT_UNUSED(kr, kr == KERN_SUCCESS);
commandLine = commandLine.arg(serviceName);
+#elif OS(WINDOWS)
+ CoreIPC::Connection::Identifier connector, clientIdentifier;
+ if (!CoreIPC::Connection::createServerAndClientIdentifiers(connector, clientIdentifier)) {
+ // FIXME: What should we do here?
+ ASSERT_NOT_REACHED();
+ }
+ commandLine = commandLine.arg(qulonglong(clientIdentifier));
+ // Ensure that the child process inherits the client identifier.
+ ::SetHandleInformation(clientIdentifier, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
#else
int sockets[2];
if (socketpair(AF_UNIX, SOCKET_TYPE, 0, sockets) == -1) {
@@ -153,7 +169,7 @@
webProcess->setProcessChannelMode(QProcess::ForwardedChannels);
webProcess->start(commandLine);
-#if !OS(DARWIN)
+#if OS(UNIX) && !OS(DARWIN)
// Don't expose the web socket to possible future web processes
while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) {
if (errno != EINTR) {
@@ -175,7 +191,9 @@
return;
}
+#if OS(UNIX)
setpriority(PRIO_PROCESS, webProcess->pid(), 10);
+#endif
RunLoop::main()->dispatch(bind(&WebKit::ProcessLauncher::didFinishLaunchingProcess, this, webProcess, connector));
}
Modified: trunk/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp (127966 => 127967)
--- trunk/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp 2012-09-08 10:48:09 UTC (rev 127966)
+++ trunk/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp 2012-09-08 10:50:37 UTC (rev 127967)
@@ -172,12 +172,20 @@
}
#else
bool wasNumber = false;
- int identifier = app->arguments().at(1).toInt(&wasNumber, 10);
+ qulonglong id = app->arguments().at(1).toULongLong(&wasNumber, 10);
if (!wasNumber) {
qDebug() << "Error: connection identifier wrong.";
return 1;
}
+ CoreIPC::Connection::Identifier identifier;
+#if OS(WINDOWS)
+ // Convert to HANDLE
+ identifier = reinterpret_cast<CoreIPC::Connection::Identifier>(id);
+#else
+ // Convert to int
+ identifier = static_cast<CoreIPC::Connection::Identifier>(id);
#endif
+#endif
#if USE(ACCELERATED_COMPOSITING)
CoordinatedGraphicsLayer::initFactory();
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes