Title: [150491] trunk/Source/WebKit2
- Revision
- 150491
- Author
- [email protected]
- Date
- 2013-05-21 17:07:02 -0700 (Tue, 21 May 2013)
Log Message
PPT: Closing tab that is hung or chewing 100% CPU leaves abandoned WebProcess.
<http://webkit.org/b/116464>
<rdar://problem/10103795>
Reviewed by Anders Carlsson.
Simplify the web process sacrifice ritual. Instead of murderizing the process when its last tab closes,
just shut down the CoreIPC connection from the UI process. The web process, upon noticing this,
will start a 10 second watchdog timer, and if it hasn't shut down by the time it fires, well, it'll shut down.
(WebKit::WebProcessProxy::removeWebPage):
When the last page is removed from a WebProcessProxy, disconnect the process so that it'll die off
eventually, even if the WebPage::Close message never gets properly handled.
* Shared/ChildProcessProxy.h:
* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::abortProcessLaunchIfNeeded):
Added a helper to abort any in-progress launch of a new web process. Otherwise we'll have a race
where the exiting web process may get re-used for a new tab.
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::enableSuddenTermination):
(WebKit::WebProcessProxy::disableSuddenTermination):
Remove WebProcessProxy's sudden termination counter. The web process will do what it needs in
response to the WebPage::Close message. We still forward these calls to NSProcessInfo on Mac though.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (150490 => 150491)
--- trunk/Source/WebKit2/ChangeLog 2013-05-22 00:03:15 UTC (rev 150490)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-22 00:07:02 UTC (rev 150491)
@@ -1,3 +1,36 @@
+2013-05-21 Andreas Kling <[email protected]>
+
+ PPT: Closing tab that is hung or chewing 100% CPU leaves abandoned WebProcess.
+ <http://webkit.org/b/116464>
+ <rdar://problem/10103795>
+
+ Reviewed by Anders Carlsson.
+
+ Simplify the web process sacrifice ritual. Instead of murderizing the process when its last tab closes,
+ just shut down the CoreIPC connection from the UI process. The web process, upon noticing this,
+ will start a 10 second watchdog timer, and if it hasn't shut down by the time it fires, well, it'll shut down.
+
+ (WebKit::WebProcessProxy::removeWebPage):
+
+ When the last page is removed from a WebProcessProxy, disconnect the process so that it'll die off
+ eventually, even if the WebPage::Close message never gets properly handled.
+
+ * Shared/ChildProcessProxy.h:
+ * Shared/ChildProcessProxy.cpp:
+ (WebKit::ChildProcessProxy::abortProcessLaunchIfNeeded):
+
+ Added a helper to abort any in-progress launch of a new web process. Otherwise we'll have a race
+ where the exiting web process may get re-used for a new tab.
+
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::WebProcessProxy):
+ (WebKit::WebProcessProxy::enableSuddenTermination):
+ (WebKit::WebProcessProxy::disableSuddenTermination):
+
+ Remove WebProcessProxy's sudden termination counter. The web process will do what it needs in
+ response to the WebPage::Close message. We still forward these calls to NSProcessInfo on Mac though.
+
2013-05-21 Anders Carlsson <[email protected]>
Fix build.
Modified: trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp (150490 => 150491)
--- trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp 2013-05-22 00:03:15 UTC (rev 150490)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp 2013-05-22 00:07:02 UTC (rev 150491)
@@ -143,6 +143,15 @@
m_pendingMessages.clear();
}
+void ChildProcessProxy::abortProcessLaunchIfNeeded()
+{
+ if (!isLaunching())
+ return;
+
+ m_processLauncher->invalidate();
+ m_processLauncher = 0;
+}
+
void ChildProcessProxy::clearConnection()
{
if (!m_connection)
Modified: trunk/Source/WebKit2/Shared/ChildProcessProxy.h (150490 => 150491)
--- trunk/Source/WebKit2/Shared/ChildProcessProxy.h 2013-05-22 00:03:15 UTC (rev 150490)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.h 2013-05-22 00:07:02 UTC (rev 150491)
@@ -68,6 +68,7 @@
protected:
void clearConnection();
+ void abortProcessLaunchIfNeeded();
// ProcessLauncher::Client
virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier) OVERRIDE;
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (150490 => 150491)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-05-22 00:03:15 UTC (rev 150490)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-05-22 00:07:02 UTC (rev 150491)
@@ -91,7 +91,6 @@
: m_responsivenessTimer(this)
, m_context(context)
, m_mayHaveUniversalFileReadSandboxExtension(false)
- , m_suddenTerminationCounter(0)
#if ENABLE(CUSTOM_PROTOCOLS)
, m_customProtocolManagerProxy(this)
#endif
@@ -201,12 +200,11 @@
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 (!m_suddenTerminationCounter && canTerminateChildProcess() && m_context->usesNetworkProcess())
- requestTermination();
-#endif
+ // If this was the last WebPage open in that web process, and we have no other reason to keep it alive, let it go.
+ if (canTerminateChildProcess()) {
+ abortProcessLaunchIfNeeded();
+ disconnect();
+ }
}
Vector<WebPageProxy*> WebProcessProxy::pages() const
@@ -673,7 +671,6 @@
return;
WebCore::enableSuddenTermination();
- m_suddenTerminationCounter--;
}
void WebProcessProxy::disableSuddenTermination()
@@ -682,7 +679,6 @@
return;
WebCore::disableSuddenTermination();
- m_suddenTerminationCounter++;
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (150490 => 150491)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-05-22 00:03:15 UTC (rev 150490)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-05-22 00:07:02 UTC (rev 150491)
@@ -194,8 +194,6 @@
bool m_mayHaveUniversalFileReadSandboxExtension; // True if a read extension for "/" was ever granted - we don't track whether WebProcess still has it.
HashSet<String> m_localPathsWithAssumedReadAccess;
- unsigned m_suddenTerminationCounter;
-
WebPageProxyMap m_pageMap;
WebFrameProxyMap m_frameMap;
WebBackForwardListItemMap m_backForwardListItemMap;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes