Title: [151370] releases/WebKitGTK/webkit-2.0/Source/WebKit2
Revision
151370
Author
[email protected]
Date
2013-06-10 02:31:30 -0700 (Mon, 10 Jun 2013)

Log Message

Merge r149934 - When possible, terminate web processes immediately when closing their last page.
<http://webkit.org/b/115964>
<rdar://problem/13869266>

Reviewed by Geoffrey Garen.

When we're using a network process, there's no need for the UI process to wait for web processes
to clear resource caches and terminate nicely.

We can just kill them off right away in WebProcessProxy::removeWebPage() when the last page is closed.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::removeWebPage):

    Terminate the child process immediately if possible.

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::canTerminateChildProcess):
(WebKit::WebProcessProxy::shouldTerminate):

    Broke out the logic from the shouldTerminate() IPC message handler into a separate function
    so we can call it from removeWebPage().

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog (151369 => 151370)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog	2013-06-10 09:24:16 UTC (rev 151369)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog	2013-06-10 09:31:30 UTC (rev 151370)
@@ -1,3 +1,28 @@
+2013-05-11  Andreas Kling  <[email protected]>
+
+        When possible, terminate web processes immediately when closing their last page.
+        <http://webkit.org/b/115964>
+        <rdar://problem/13869266>
+
+        Reviewed by Geoffrey Garen.
+
+        When we're using a network process, there's no need for the UI process to wait for web processes
+        to clear resource caches and terminate nicely.
+
+        We can just kill them off right away in WebProcessProxy::removeWebPage() when the last page is closed.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::removeWebPage):
+
+            Terminate the child process immediately if possible.
+
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::canTerminateChildProcess):
+        (WebKit::WebProcessProxy::shouldTerminate):
+
+            Broke out the logic from the shouldTerminate() IPC message handler into a separate function
+            so we can call it from removeWebPage().
+
 2013-05-11  Anders Carlsson  <[email protected]>
 
         Crash when terminating a process that has not been fully launched

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp (151369 => 151370)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-06-10 09:24:16 UTC (rev 151369)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-06-10 09:31:30 UTC (rev 151370)
@@ -193,6 +193,13 @@
     m_processSuppressiblePages.remove(pageID);
     updateProcessSuppressionState();
 #endif
+
+#if ENABLE(NETWORK_PROCESS)
+    // Terminate the web process immediately if we have enough information to confidently do so.
+    // This only works if we're using a network process. Otherwise we have to wait for the web process to clean up.
+    if (canTerminateChildProcess() && m_context->usesNetworkProcess())
+        requestTermination();
+#endif
 }
 
 Vector<WebPageProxy*> WebProcessProxy::pages() const
@@ -498,19 +505,29 @@
     return result;
 }
 
-void WebProcessProxy::shouldTerminate(bool& shouldTerminate)
+bool WebProcessProxy::canTerminateChildProcess()
 {
-    if (!m_pageMap.isEmpty() || (m_downloadProxyMap && !m_downloadProxyMap->isEmpty()) || !m_context->shouldTerminate(this)) {
-        shouldTerminate = false;
-        return;
-    }
+    if (!m_pageMap.isEmpty())
+        return false;
 
-    shouldTerminate = true;
+    if (m_downloadProxyMap && !m_downloadProxyMap->isEmpty())
+        return false;
 
-    // We know that the web process is going to terminate so disconnect it from the context.
-    disconnect();
+    if (!m_context->shouldTerminate(this))
+        return false;
+
+    return true;
 }
 
+void WebProcessProxy::shouldTerminate(bool& shouldTerminate)
+{
+    shouldTerminate = canTerminateChildProcess();
+    if (shouldTerminate) {
+        // We know that the web process is going to terminate so disconnect it from the context.
+        disconnect();
+    }
+}
+
 void WebProcessProxy::updateTextCheckerState()
 {
     if (canSendMessage())

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h (151369 => 151370)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-06-10 09:24:16 UTC (rev 151369)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-06-10 09:31:30 UTC (rev 151370)
@@ -178,6 +178,8 @@
     void didReceiveWebProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
     void didReceiveSyncWebProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&);
 
+    bool canTerminateChildProcess();
+
     ResponsivenessTimer m_responsivenessTimer;
     
     RefPtr<WebConnectionToWebProcess> m_webConnection;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to