Commit 288faf7d authored by andersca@apple.com's avatar andersca@apple.com

WebPageProxy should be a MessageSender

https://bugs.webkit.org/show_bug.cgi?id=125654

Reviewed by Sam Weinig.

* Platform/CoreIPC/MessageSender.cpp:
(CoreIPC::MessageSender::sendMessage):
* Platform/CoreIPC/MessageSender.h:
(CoreIPC::MessageSender::send):
* Shared/ChildProcessProxy.h:
* Shared/WebConnection.cpp:
(WebKit::WebConnection::postMessage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::sendMessage):
(WebKit::WebPageProxy::messageSenderConnection):
(WebKit::WebPageProxy::messageSenderDestinationID):
* UIProcess/WebPageProxy.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160508 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9987625b
2013-12-12 Anders Carlsson <andersca@apple.com>
WebPageProxy should be a MessageSender
https://bugs.webkit.org/show_bug.cgi?id=125654
Reviewed by Sam Weinig.
* Platform/CoreIPC/MessageSender.cpp:
(CoreIPC::MessageSender::sendMessage):
* Platform/CoreIPC/MessageSender.h:
(CoreIPC::MessageSender::send):
* Shared/ChildProcessProxy.h:
* Shared/WebConnection.cpp:
(WebKit::WebConnection::postMessage):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::sendMessage):
(WebKit::WebPageProxy::messageSenderConnection):
(WebKit::WebPageProxy::messageSenderDestinationID):
* UIProcess/WebPageProxy.h:
2013-12-12 Anders Carlsson <andersca@apple.com>
Clean up dictionary handling a little
......
......@@ -32,11 +32,11 @@ MessageSender::~MessageSender()
{
}
bool MessageSender::sendMessage(std::unique_ptr<MessageEncoder> encoder)
bool MessageSender::sendMessage(std::unique_ptr<MessageEncoder> encoder, unsigned messageSendFlags)
{
ASSERT(messageSenderConnection());
return messageSenderConnection()->sendMessage(std::move(encoder));
return messageSenderConnection()->sendMessage(std::move(encoder), messageSendFlags);
}
} // namespace CoreIPC
......@@ -37,17 +37,17 @@ public:
template<typename U> bool send(const U& message)
{
return send(message, messageSenderDestinationID());
return send(message, messageSenderDestinationID(), 0);
}
template<typename U> bool send(const U& message, uint64_t destinationID)
template<typename U> bool send(const U& message, uint64_t destinationID, unsigned messageSendFlags = 0)
{
static_assert(!U::isSync, "Message is sync!");
auto encoder = std::make_unique<MessageEncoder>(U::receiverName(), U::name(), destinationID);
encoder->encode(message.arguments());
return sendMessage(std::move(encoder));
return sendMessage(std::move(encoder), messageSendFlags);
}
template<typename T>
......@@ -66,7 +66,7 @@ public:
return messageSenderConnection()->sendSync(std::move(message), std::move(reply), destinationID, timeout, syncSendFlags);
}
bool sendMessage(std::unique_ptr<MessageEncoder>);
virtual bool sendMessage(std::unique_ptr<MessageEncoder>, unsigned messageSendFlags);
private:
virtual Connection* messageSenderConnection() = 0;
......
......@@ -66,6 +66,8 @@ public:
PlatformProcessIdentifier processIdentifier() const { return m_processLauncher->processIdentifier(); }
bool sendMessage(std::unique_ptr<CoreIPC::MessageEncoder>, unsigned messageSendFlags);
protected:
void clearConnection();
void abortProcessLaunchIfNeeded();
......@@ -81,8 +83,6 @@ private:
virtual void connectionWillOpen(CoreIPC::Connection*);
virtual void connectionWillClose(CoreIPC::Connection*);
bool sendMessage(std::unique_ptr<CoreIPC::MessageEncoder>, unsigned messageSendFlags);
Vector<std::pair<std::unique_ptr<CoreIPC::MessageEncoder>, unsigned>> m_pendingMessages;
RefPtr<ProcessLauncher> m_processLauncher;
RefPtr<CoreIPC::Connection> m_connection;
......
......@@ -55,7 +55,7 @@ void WebConnection::postMessage(const String& messageName, API::Object* messageB
encoder->encode(messageName);
encodeMessageBody(*encoder, messageBody);
sendMessage(std::move(encoder));
sendMessage(std::move(encoder), 0);
}
void WebConnection::didClose()
......
......@@ -525,13 +525,13 @@ void WebPageProxy::initializeWebPage()
process().send(Messages::WebProcess::CreateWebPage(m_pageID, m_creationParameters), 0);
#if ENABLE(PAGE_VISIBILITY_API)
process().send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true), m_pageID);
send(Messages::WebPage::SetVisibilityState(m_visibilityState, /* isInitialState */ true));
#elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
process().send(Messages::WebPage::SetVisibilityState(isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
send(Messages::WebPage::SetVisibilityState(isViewVisible() ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true));
#endif
#if PLATFORM(MAC)
process().send(Messages::WebPage::SetSmartInsertDeleteEnabled(m_isSmartInsertDeleteEnabled), m_pageID);
send(Messages::WebPage::SetSmartInsertDeleteEnabled(m_isSmartInsertDeleteEnabled));
#endif
}
......@@ -3092,6 +3092,21 @@ void WebPageProxy::didFailToFindString(const String& string)
m_findClient.didFailToFindString(this, string);
}
bool WebPageProxy::sendMessage(std::unique_ptr<CoreIPC::MessageEncoder> encoder, unsigned messageSendFlags)
{
return m_process->sendMessage(std::move(encoder), messageSendFlags);
}
CoreIPC::Connection* WebPageProxy::messageSenderConnection()
{
return m_process->connection();
}
uint64_t WebPageProxy::messageSenderDestinationID()
{
return m_pageID;
}
void WebPageProxy::valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex)
{
m_process->send(Messages::WebPage::DidChangeSelectedIndexForActivePopupMenu(newSelectedIndex), m_pageID);
......
......@@ -34,6 +34,7 @@
#include "EditorState.h"
#include "GeolocationPermissionRequestManagerProxy.h"
#include "LayerTreeContext.h"
#include "MessageSender.h"
#include "NotificationPermissionRequestManagerProxy.h"
#include "PageLoadState.h"
#include "PlatformProcessIdentifier.h"
......@@ -313,13 +314,13 @@ private:
};
#endif
class WebPageProxy
: public API::ObjectImpl<API::Object::Type::Page>
class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
#if ENABLE(INPUT_TYPE_COLOR)
, public WebColorPicker::Client
#endif
, public WebPopupMenuProxy::Client
, public CoreIPC::MessageReceiver {
, public CoreIPC::MessageReceiver
, public CoreIPC::MessageSender {
public:
static PassRefPtr<WebPageProxy> create(PageClient&, WebProcessProxy&, WebPageGroup&, uint64_t pageID);
......@@ -863,6 +864,11 @@ private:
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, std::unique_ptr<CoreIPC::MessageEncoder>&) OVERRIDE;
// CoreIPC::MessageSender
virtual bool sendMessage(std::unique_ptr<CoreIPC::MessageEncoder>, unsigned messageSendFlags) OVERRIDE;
virtual CoreIPC::Connection* messageSenderConnection() OVERRIDE;
virtual uint64_t messageSenderDestinationID() OVERRIDE;
// WebPopupMenuProxy::Client
virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment