Changeset 127967 in webkit


Ignore:
Timestamp:
Sep 8, 2012 3:50:37 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Qt] Fix CoreIPC setup between ProcessLauncher and WebProcessMain on Windows
https://bugs.webkit.org/show_bug.cgi?id=96179

Patch by Simon Hausmann <simon.hausmann@nokia.com> 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.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r127966 r127967  
     12012-09-08  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        [Qt] Fix CoreIPC setup between ProcessLauncher and WebProcessMain on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=96179
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
     9        (WebKit::ProcessLauncher::launchProcess): Hide Unixy platform specific code
     10        and includes behind appropriate platform #ifdefs and use
     11        CoreIPC::Connection::createServerAndClientIdentifiers to set up the IPC pipes.
     12        We also need to tell Windows about our intent of using the client handle in
     13        the child web process.
     14        * WebProcess/qt/WebProcessMainQt.cpp:
     15        (WebKit::WebProcessMainQt): After retrieving the IPC identifier we call
     16        WebKit::WebProcess::shared().initialize with it. That function actually
     17        cares a CIPC::Connection::Identifier as argument, which happens to be an
     18        int on Unix, but it's actually a HANDLE on Windows. Change the parameter
     19        type according to and a reinterpret_cast from the converted unsigned integer,
     20        similar to WebProcessMainWin.cpp.
     21
    1222012-09-08  Christophe Dumez  <christophe.dumez@intel.com>
    223
  • trunk/Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp

    r127253 r127967  
    3939#include <WebCore/NotImplemented.h>
    4040#include <WebCore/RunLoop.h>
     41#include <wtf/HashSet.h>
     42#include <wtf/PassRefPtr.h>
     43#include <wtf/Threading.h>
     44#include <wtf/text/WTFString.h>
     45
     46#if defined(Q_OS_UNIX)
    4147#include <errno.h>
    4248#include <fcntl.h>
     
    4652#include <sys/socket.h>
    4753#include <unistd.h>
    48 #include <wtf/HashSet.h>
    49 #include <wtf/PassRefPtr.h>
    50 #include <wtf/Threading.h>
    51 #include <wtf/text/WTFString.h>
     54#endif
    5255
    5356#if defined(Q_OS_LINUX)
    5457#include <sys/prctl.h>
    5558#include <signal.h>
     59#endif
     60
     61#if OS(WINDOWS)
     62#include <windows.h>
    5663#endif
    5764
     
    128135
    129136    commandLine = commandLine.arg(serviceName);
     137#elif OS(WINDOWS)
     138    CoreIPC::Connection::Identifier connector, clientIdentifier;
     139    if (!CoreIPC::Connection::createServerAndClientIdentifiers(connector, clientIdentifier)) {
     140        // FIXME: What should we do here?
     141        ASSERT_NOT_REACHED();
     142    }
     143    commandLine = commandLine.arg(qulonglong(clientIdentifier));
     144    // Ensure that the child process inherits the client identifier.
     145    ::SetHandleInformation(clientIdentifier, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
    130146#else
    131147    int sockets[2];
     
    154170    webProcess->start(commandLine);
    155171
    156 #if !OS(DARWIN)
     172#if OS(UNIX) && !OS(DARWIN)
    157173    // Don't expose the web socket to possible future web processes
    158174    while (fcntl(sockets[0], F_SETFD, FD_CLOEXEC) == -1) {
     
    176192    }
    177193
     194#if OS(UNIX)
    178195    setpriority(PRIO_PROCESS, webProcess->pid(), 10);
     196#endif
    179197
    180198    RunLoop::main()->dispatch(bind(&WebKit::ProcessLauncher::didFinishLaunchingProcess, this, webProcess, connector));
  • trunk/Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp

    r127726 r127967  
    173173#else
    174174    bool wasNumber = false;
    175     int identifier = app->arguments().at(1).toInt(&wasNumber, 10);
     175    qulonglong id = app->arguments().at(1).toULongLong(&wasNumber, 10);
    176176    if (!wasNumber) {
    177177        qDebug() << "Error: connection identifier wrong.";
    178178        return 1;
    179179    }
     180    CoreIPC::Connection::Identifier identifier;
     181#if OS(WINDOWS)
     182    // Convert to HANDLE
     183    identifier = reinterpret_cast<CoreIPC::Connection::Identifier>(id);
     184#else
     185    // Convert to int
     186    identifier = static_cast<CoreIPC::Connection::Identifier>(id);
     187#endif
    180188#endif
    181189#if USE(ACCELERATED_COMPOSITING)
Note: See TracChangeset for help on using the changeset viewer.