From 470286ecfe79d59df14944e5b5d34630fc739391 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Nov 2012 09:09:45 +0100 Subject: Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485) Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann --- .../UIProcess/WebConnectionToWebProcess.cpp | 78 +++++----------------- 1 file changed, 18 insertions(+), 60 deletions(-) (limited to 'Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp') diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp index a80cfbc30..eb6d5efa2 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp @@ -26,28 +26,26 @@ #include "config.h" #include "WebConnectionToWebProcess.h" -#include "WebConnectionMessageKinds.h" +#include "WebConnectionMessages.h" #include "WebContextUserMessageCoders.h" #include "WebProcessProxy.h" -using namespace WebCore; - namespace WebKit { -PassRefPtr WebConnectionToWebProcess::create(WebProcessProxy* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop) +PassRefPtr WebConnectionToWebProcess::create(WebProcessProxy* process) { - return adoptRef(new WebConnectionToWebProcess(process, connectionIdentifier, runLoop)); + return adoptRef(new WebConnectionToWebProcess(process)); } -WebConnectionToWebProcess::WebConnectionToWebProcess(WebProcessProxy* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop) - : WebConnection(CoreIPC::Connection::createServerConnection(connectionIdentifier, this, runLoop)) - , m_process(process) +WebConnectionToWebProcess::WebConnectionToWebProcess(WebProcessProxy* process) + : m_process(process) { -#if OS(DARWIN) - m_connection->setShouldCloseConnectionOnMachExceptions(); -#elif PLATFORM(QT) && !OS(WINDOWS) - m_connection->setShouldCloseConnectionOnProcessTermination(process->processIdentifier()); -#endif + m_process->addMessageReceiver(Messages::WebConnection::messageReceiverName(), this); +} + +void WebConnectionToWebProcess::invalidate() +{ + m_process = 0; } // WebConnection @@ -60,62 +58,22 @@ void WebConnectionToWebProcess::encodeMessageBody(CoreIPC::ArgumentEncoder& enco bool WebConnectionToWebProcess::decodeMessageBody(CoreIPC::ArgumentDecoder& decoder, RefPtr& messageBody) { WebContextUserMessageDecoder messageBodyDecoder(messageBody, m_process); - - if (!decoder.decode(messageBodyDecoder)) - return false; - - return true; + return decoder.decode(messageBodyDecoder); } -// CoreIPC::Connection::Client - -void WebConnectionToWebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +CoreIPC::Connection* WebConnectionToWebProcess::connection() const { - if (messageID.is()) { - didReceiveWebConnectionMessage(connection, messageID, decoder); - return; - } - - m_process->didReceiveMessage(connection, messageID, decoder); + return m_process->connection(); } -void WebConnectionToWebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr& replyEncoder) +uint64_t WebConnectionToWebProcess::destinationID() const { - m_process->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); -} - -void WebConnectionToWebProcess::didClose(CoreIPC::Connection* connection) -{ - RefPtr protector(this); - - m_process->didClose(connection); - - // Tell the API client that the connection closed. - m_client.didClose(this); -} - -void WebConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) -{ - RefPtr protector = this; - RefPtr process = m_process; - - // This will invalidate the CoreIPC::Connection and the WebProcessProxy member - // variables, so we should be careful not to use them after this call. - process->didReceiveInvalidMessage(connection, messageReceiverName, messageName); - - // Since we've invalidated the connection we'll never get a CoreIPC::Connection::Client::didClose - // callback so we'll explicitly call it here instead. - process->didClose(connection); - - // Tell the API client that the connection closed. - m_client.didClose(this); + return 0; } -#if PLATFORM(WIN) -Vector WebConnectionToWebProcess::windowsToReceiveSentMessagesWhileWaitingForSyncReply() +bool WebConnectionToWebProcess::hasValidConnection() const { - return m_process->windowsToReceiveSentMessagesWhileWaitingForSyncReply(); + return m_process; } -#endif } // namespace WebKit -- cgit v1.2.1