[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 18:39:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e9c9bd438d9e563f443dde2d57a22fd6991d20e3
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 15 12:34:05 2010 +0000

    2010-12-15  Jan Erik Hanssen  <jhanssen at sencha.com>
    
            Reviewed by Andreas Kling.
    
            [Qt][WK2] webkit2 does not compile on OS X
            https://bugs.webkit.org/show_bug.cgi?id=50128
    
            prctl(2) is only available on Linux, so use an atexit handler for killing
            all the child processes when the process is exiting.
    
            * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
            (WebKit::cleanupProcesses):
            (WebKit::QtWebProcess::QtWebProcess):
            (WebKit::QtWebProcess::processStateChanged):
            (WebKit::ProcessLauncherHelper::instance):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74108 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 972331b..ebcb3c9 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-15  Jan Erik Hanssen  <jhanssen at sencha.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt][WK2] webkit2 does not compile on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=50128
+
+        prctl(2) is only available on Linux, so use an atexit handler for killing
+        all the child processes when the process is exiting.
+
+        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp:
+        (WebKit::cleanupProcesses):
+        (WebKit::QtWebProcess::QtWebProcess):
+        (WebKit::QtWebProcess::processStateChanged):
+        (WebKit::ProcessLauncherHelper::instance):
+
 2010-12-14  Anders Carlsson  <andersca at apple.com>
 
         Fix Windows build.
diff --git a/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp b/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
index 227ebaa..674d7e1 100644
--- a/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
+++ b/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
@@ -33,6 +33,7 @@
 #include "WebProcess.h"
 #include <runtime/InitializeThreading.h>
 #include <string>
+#include <wtf/HashSet.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/text/WTFString.h>
@@ -47,10 +48,6 @@
 
 #include <sys/resource.h>
 #include <unistd.h>
-#if defined Q_OS_UNIX
-#include <sys/prctl.h>
-#include <signal.h>
-#endif
 
 using namespace WebCore;
 
@@ -71,23 +68,41 @@ private:
     Q_SLOT void newConnection();
 };
 
+Q_GLOBAL_STATIC(WTF::HashSet<QProcess*>, processes);
+
+static void cleanupProcesses()
+{
+    WTF::HashSet<QProcess*>::const_iterator it = processes()->begin();
+    while (it != processes()->end()) {
+        (*it)->kill();
+        ++it;
+    }
+}
+
 class QtWebProcess : public QProcess
 {
     Q_OBJECT
 public:
     QtWebProcess(QObject* parent = 0)
         : QProcess(parent)
-    {}
+    {
+        connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(processStateChanged(QProcess::ProcessState)));
+    }
 
-protected:
-    virtual void setupChildProcess();
+private slots:
+    void processStateChanged(QProcess::ProcessState state);
 };
 
-void QtWebProcess::setupChildProcess()
+void QtWebProcess::processStateChanged(QProcess::ProcessState state)
 {
-#if defined Q_OS_UNIX
-    prctl(PR_SET_PDEATHSIG, SIGINT);
-#endif
+    QProcess* process = qobject_cast<QProcess*>(sender());
+    if (!process)
+        return;
+
+    if (state == QProcess::Running)
+        processes()->add(process);
+    else if (state == QProcess::NotRunning)
+        processes()->remove(process);
 }
 
 void ProcessLauncherHelper::launch(WebKit::ProcessLauncher* launcher)
@@ -145,7 +160,15 @@ ProcessLauncherHelper::ProcessLauncherHelper()
 
 ProcessLauncherHelper* ProcessLauncherHelper::instance()
 {
-    static ProcessLauncherHelper* result = new ProcessLauncherHelper();
+    static ProcessLauncherHelper* result = 0;
+    if (!result) {
+        result = new ProcessLauncherHelper();
+
+        // The purpose of the following line is to ensure that our static is initialized before the exit handler is installed.
+        processes()->clear();
+
+        atexit(cleanupProcesses);
+    }
     return result;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list