From 81bc750723a18f21cd17d1b173cd2a4dda9cea6e Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 24 May 2011 11:24:40 +0100 Subject: Merge WebKit at r80534: Intial merge by Git Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61 --- Source/WebKit2/UIProcess/WebProcessProxy.cpp | 60 ++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 17 deletions(-) (limited to 'Source/WebKit2/UIProcess/WebProcessProxy.cpp') diff --git a/Source/WebKit2/UIProcess/WebProcessProxy.cpp b/Source/WebKit2/UIProcess/WebProcessProxy.cpp index 67dc46b..42e3408 100644 --- a/Source/WebKit2/UIProcess/WebProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/WebProcessProxy.cpp @@ -35,7 +35,6 @@ #include "WebContext.h" #include "WebNavigationDataStore.h" #include "WebPageProxy.h" -#include "WebProcessManager.h" #include "WebProcessMessages.h" #include "WebProcessProxyMessages.h" #include "WebProcessProxyMessageKinds.h" @@ -111,6 +110,25 @@ void WebProcessProxy::connect() } } +void WebProcessProxy::disconnect() +{ + if (m_connection) { + m_connection->invalidate(); + m_connection = nullptr; + } + + m_responsivenessTimer.stop(); + + Vector > frames; + copyValuesToVector(m_frameMap, frames); + + for (size_t i = 0, size = frames.size(); i < size; ++i) + frames[i]->disconnect(); + m_frameMap.clear(); + + m_context->disconnectProcess(this); +} + bool WebProcessProxy::sendMessage(CoreIPC::MessageID messageID, PassOwnPtr arguments, unsigned messageSendFlags) { // If we're waiting for the web process to launch, we need to stash away the messages so we can send them once we have @@ -230,8 +248,12 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC if (messageID.is() || messageID.is() || messageID.is() + || messageID.is() + || messageID.is() || messageID.is() - || messageID.is()) { + || messageID.is() + || messageID.is() + || messageID.is()) { m_context->didReceiveMessage(connection, messageID, arguments); return; } @@ -249,6 +271,9 @@ void WebProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, CoreIPC::ArgumentEncoder* reply) { + if (messageID.is()) + return didReceiveSyncWebProcessProxyMessage(connection, messageID, arguments, reply); + #if ENABLE(PLUGIN_PROCESS) if (messageID.is()) { switch (messageID.get()) { @@ -282,26 +307,14 @@ CoreIPC::SyncReplyMode WebProcessProxy::didReceiveSyncMessage(CoreIPC::Connectio void WebProcessProxy::didClose(CoreIPC::Connection*) { - // Protect ourselves, as the call to the shared WebProcessManager's processDidClose() - // below may otherwise cause us to be deleted before we can finish our work. + // Protect ourselves, as the call to disconnect() below may otherwise cause us + // to be deleted before we can finish our work. RefPtr protect(this); - - m_connection = nullptr; - m_responsivenessTimer.stop(); - - Vector > frames; - copyValuesToVector(m_frameMap, frames); - - for (size_t i = 0, size = frames.size(); i < size; ++i) - frames[i]->disconnect(); - m_frameMap.clear(); Vector > pages; copyValuesToVector(m_pageMap, pages); - m_context->processDidClose(this); - - WebProcessManager::shared().processDidClose(this, m_context); + disconnect(); for (size_t i = 0, size = pages.size(); i < size; ++i) pages[i]->processDidCrash(); @@ -411,6 +424,19 @@ size_t WebProcessProxy::frameCountInPage(WebPageProxy* page) const return result; } +void WebProcessProxy::shouldTerminate(bool& shouldTerminate) +{ + if (!m_pageMap.isEmpty() || !m_context->shouldTerminate(this)) { + shouldTerminate = false; + return; + } + + shouldTerminate = true; + + // We know that the web process is going to terminate so disconnect it from the context. + disconnect(); +} + void WebProcessProxy::updateTextCheckerState() { if (!isValid()) -- cgit v1.1