Title: [96494] trunk/Source/WebKit2
Revision
96494
Author
[email protected]
Date
2011-10-03 07:04:16 -0700 (Mon, 03 Oct 2011)

Log Message

[Qt][WebKit2][Mac] WebProcess should exit automatically when UIProcess dies.
https://bugs.webkit.org/show_bug.cgi?id=68439

We use a dispatch queue and a dispatch source in the WebProcess
to receive a notification when the UI Process dies.
The WebProcess then commits suicide.

Patch by Zeno Albisser <[email protected]> on 2011-10-03
Reviewed by Andreas Kling.

* WebProcess/qt/WebProcessQt.cpp:
(WebKit::parentProcessDiedCallback):
(WebKit::WebProcess::platformInitializeWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (96493 => 96494)


--- trunk/Source/WebKit2/ChangeLog	2011-10-03 13:58:35 UTC (rev 96493)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-03 14:04:16 UTC (rev 96494)
@@ -1,3 +1,18 @@
+2011-10-03  Zeno Albisser  <[email protected]>
+
+        [Qt][WebKit2][Mac] WebProcess should exit automatically when UIProcess dies.
+        https://bugs.webkit.org/show_bug.cgi?id=68439
+
+        We use a dispatch queue and a dispatch source in the WebProcess
+        to receive a notification when the UI Process dies.
+        The WebProcess then commits suicide.
+
+        Reviewed by Andreas Kling.
+
+        * WebProcess/qt/WebProcessQt.cpp:
+        (WebKit::parentProcessDiedCallback):
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2011-10-02  Zeno Albisser  <[email protected]>
 
         [Qt][WK2][Mac] WebKit2 does not build on mac after merge of Qt5 refactor branch.

Modified: trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp (96493 => 96494)


--- trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp	2011-10-03 13:58:35 UTC (rev 96493)
+++ trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp	2011-10-03 14:04:16 UTC (rev 96494)
@@ -27,11 +27,17 @@
 #include "WebProcess.h"
 
 #include "WebProcessCreationParameters.h"
-#include <WebCore/RuntimeEnabledFeatures.h>
+
+#include <QCoreApplication>
 #include <QNetworkAccessManager>
 #include <QNetworkCookieJar>
 #include <WebCore/CookieJarQt.h>
+#include <WebCore/RuntimeEnabledFeatures.h>
 
+#if defined(Q_OS_MACX)
+#include <dispatch/dispatch.h>
+#endif
+
 namespace WebKit {
 
 void WebProcess::platformSetCacheModel(CacheModel)
@@ -43,6 +49,13 @@
 {
 }
 
+#if defined(Q_OS_MACX)
+static void parentProcessDiedCallback(void*)
+{
+    QCoreApplication::quit();
+}
+#endif
+
 void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::ArgumentDecoder* arguments)
 {
     m_networkAccessManager = new QNetworkAccessManager;
@@ -52,6 +65,16 @@
     // Do not let QNetworkAccessManager delete the jar.
     jar->setParent(0);
 
+#if defined(Q_OS_MACX)
+    pid_t ppid = getppid();
+    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+    dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC, ppid, DISPATCH_PROC_EXIT, queue);
+    if (source) {
+        dispatch_source_set_event_handler_f(source, parentProcessDiedCallback);
+        dispatch_resume(source);
+    }
+#endif
+
     // Disable runtime enabled features that have no WebKit2 implementation yet.
 #if ENABLE(DEVICE_ORIENTATION)
     WebCore::RuntimeEnabledFeatures::setDeviceMotionEnabled(false);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to