Title: [89433] trunk/Source/WebKit2
Revision
89433
Author
carlo...@webkit.org
Date
2011-06-22 08:44:04 -0700 (Wed, 22 Jun 2011)

Log Message

2011-06-22  Carlos Garcia Campos  <cgar...@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] Remove Connection::setShouldCloseConnectionOnProcessTermination()
        https://bugs.webkit.org/show_bug.cgi?id=61627

        Don't use Connection::setShouldCloseConnectionOnProcessTermination() for the
        GTK port, when the process finishes the connection is closed and
        the other process is already notified. We still need to monitor
        the child process so that it doesn't become a zombie when it dntabi

        * Platform/CoreIPC/Connection.h:
        * Platform/CoreIPC/unix/ConnectionUnix.cpp:
        * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
        (WebKit::childFinishedFunction):
        (WebKit::ProcessLauncher::launchProcess):
        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::didFinishLaunching):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (89432 => 89433)


--- trunk/Source/WebKit2/ChangeLog	2011-06-22 15:27:54 UTC (rev 89432)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-22 15:44:04 UTC (rev 89433)
@@ -1,3 +1,23 @@
+2011-06-22  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Remove Connection::setShouldCloseConnectionOnProcessTermination()
+        https://bugs.webkit.org/show_bug.cgi?id=61627
+
+        Don't use Connection::setShouldCloseConnectionOnProcessTermination() for the
+        GTK port, when the process finishes the connection is closed and
+        the other process is already notified. We still need to monitor
+        the child process so that it doesn't become a zombie when it dntabi
+
+        * Platform/CoreIPC/Connection.h:
+        * Platform/CoreIPC/unix/ConnectionUnix.cpp:
+        * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+        (WebKit::childFinishedFunction):
+        (WebKit::ProcessLauncher::launchProcess):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didFinishLaunching):
+
 2011-06-20  Dimitri Glazkov  <dglaz...@chromium.org>
 
         Reviewed by Kent Tamura.

Modified: trunk/Source/WebKit2/Platform/CoreIPC/Connection.h (89432 => 89433)


--- trunk/Source/WebKit2/Platform/CoreIPC/Connection.h	2011-06-22 15:27:54 UTC (rev 89432)
+++ trunk/Source/WebKit2/Platform/CoreIPC/Connection.h	2011-06-22 15:44:04 UTC (rev 89433)
@@ -118,7 +118,7 @@
 
 #if PLATFORM(MAC)
     void setShouldCloseConnectionOnMachExceptions();
-#elif PLATFORM(QT) || PLATFORM(GTK)
+#elif PLATFORM(QT)
     void setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier);
 #endif
 

Modified: trunk/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp (89432 => 89433)


--- trunk/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp	2011-06-22 15:27:54 UTC (rev 89432)
+++ trunk/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp	2011-06-22 15:44:04 UTC (rev 89433)
@@ -457,7 +457,7 @@
     return true;
 }
 
-#if PLATFORM(QT) || PLATFORM(GTK)
+#if PLATFORM(QT)
 void Connection::setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier process)
 {
     m_connectionQueue.scheduleWorkOnTermination(process, WorkItem::create(this, &Connection::connectionDidClose));

Modified: trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp (89432 => 89433)


--- trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp	2011-06-22 15:27:54 UTC (rev 89432)
+++ trunk/Source/WebKit2/UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp	2011-06-22 15:44:04 UTC (rev 89433)
@@ -56,6 +56,14 @@
 #endif
 }
 
+static void childFinishedFunction(GPid, gint status, gpointer userData)
+{
+    if (WIFEXITED(status) && !WEXITSTATUS(status))
+        return;
+
+    close(GPOINTER_TO_INT(userData));
+}
+
 void ProcessLauncher::launchProcess()
 {
     GPid pid = 0;
@@ -83,6 +91,11 @@
 
     close(sockets[0]);
     m_processIdentifier = pid;
+
+    // Monitor the child process, it calls waitpid to prevent the child process from becomming a zombie,
+    // and it allows us to close the socket when the child process crashes.
+    g_child_watch_add(m_processIdentifier, childFinishedFunction, GINT_TO_POINTER(sockets[1]));
+
     // We've finished launching the process, message back to the main run loop.
     RunLoop::main()->scheduleWork(WorkItem::create(this, &ProcessLauncher::didFinishLaunchingProcess, m_processIdentifier, sockets[1]));
 }

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (89432 => 89433)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2011-06-22 15:27:54 UTC (rev 89432)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2011-06-22 15:44:04 UTC (rev 89433)
@@ -352,7 +352,7 @@
     m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main());
 #if PLATFORM(MAC)
     m_connection->setShouldCloseConnectionOnMachExceptions();
-#elif PLATFORM(QT) || PLATFORM(GTK)
+#elif PLATFORM(QT)
     m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier());
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to