diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:09:45 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:10:13 +0100 |
commit | 470286ecfe79d59df14944e5b5d34630fc739391 (patch) | |
tree | 43983212872e06cebefd2ae474418fa2908ca54c /Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp | |
parent | 23037105e948c2065da5a937d3a2396b0ff45c1e (diff) | |
download | qtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz |
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp | 78 |
1 files changed, 18 insertions, 60 deletions
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> WebConnectionToWebProcess::create(WebProcessProxy* process, CoreIPC::Connection::Identifier connectionIdentifier, RunLoop* runLoop) +PassRefPtr<WebConnectionToWebProcess> 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<APIObject>& 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<CoreIPC::MessageClassWebConnection>()) { - 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<CoreIPC::MessageEncoder>& replyEncoder) +uint64_t WebConnectionToWebProcess::destinationID() const { - m_process->didReceiveSyncMessage(connection, messageID, decoder, replyEncoder); -} - -void WebConnectionToWebProcess::didClose(CoreIPC::Connection* connection) -{ - RefPtr<WebConnectionToWebProcess> 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<WebConnectionToWebProcess> protector = this; - RefPtr<WebProcessProxy> 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<HWND> WebConnectionToWebProcess::windowsToReceiveSentMessagesWhileWaitingForSyncReply() +bool WebConnectionToWebProcess::hasValidConnection() const { - return m_process->windowsToReceiveSentMessagesWhileWaitingForSyncReply(); + return m_process; } -#endif } // namespace WebKit |