<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[177768] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/177768">177768</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-27 12:59:29 -0800 (Sat, 27 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Switch WebConnection over to sending objects with UserData
https://bugs.webkit.org/show_bug.cgi?id=139967
Reviewed by Oliver Hunt.
* Shared/WebConnection.cpp:
(WebKit::WebConnection::postMessage):
No need to construct the message manually anymore.
(WebKit::WebConnection::handleMessage):
No need to decode the message manually, just get the object from the UserData message body,
convert any handles to objects, and dispatch the message.
* Shared/WebConnection.h:
Remove now unused members.
* Shared/WebConnection.messages.in:
Give HandleMessage a proper signature.
* UIProcess/WebConnectionToWebProcess.cpp:
(WebKit::WebConnectionToWebProcess::transformHandlesToObjects):
(WebKit::WebConnectionToWebProcess::transformObjectsToHandles):
Call the WebProcessProxy version.
(WebKit::WebConnectionToWebProcess::encodeMessageBody): Deleted.
(WebKit::WebConnectionToWebProcess::decodeMessageBody): Deleted.
* UIProcess/WebConnectionToWebProcess.h:
* WebProcess/WebConnectionToUIProcess.cpp:
(WebKit::WebConnectionToUIProcess::encodeMessageBody): Deleted.
(WebKit::WebConnectionToUIProcess::decodeMessageBody): Deleted.
* WebProcess/WebConnectionToUIProcess.h:
Delete more unused members.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebConnectioncpp">trunk/Source/WebKit2/Shared/WebConnection.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebConnectionh">trunk/Source/WebKit2/Shared/WebConnection.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebConnectionmessagesin">trunk/Source/WebKit2/Shared/WebConnection.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebConnectionToWebProcesscpp">trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebConnectionToWebProcessh">trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebConnectionToUIProcesscpp">trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebConnectionToUIProcessh">trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2014-12-27 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><ins>+ Switch WebConnection over to sending objects with UserData
+ https://bugs.webkit.org/show_bug.cgi?id=139967
+
+ Reviewed by Oliver Hunt.
+
+ * Shared/WebConnection.cpp:
+ (WebKit::WebConnection::postMessage):
+ No need to construct the message manually anymore.
+
+ (WebKit::WebConnection::handleMessage):
+ No need to decode the message manually, just get the object from the UserData message body,
+ convert any handles to objects, and dispatch the message.
+
+ * Shared/WebConnection.h:
+ Remove now unused members.
+
+ * Shared/WebConnection.messages.in:
+ Give HandleMessage a proper signature.
+
+ * UIProcess/WebConnectionToWebProcess.cpp:
+ (WebKit::WebConnectionToWebProcess::transformHandlesToObjects):
+ (WebKit::WebConnectionToWebProcess::transformObjectsToHandles):
+ Call the WebProcessProxy version.
+
+ (WebKit::WebConnectionToWebProcess::encodeMessageBody): Deleted.
+ (WebKit::WebConnectionToWebProcess::decodeMessageBody): Deleted.
+
+ * UIProcess/WebConnectionToWebProcess.h:
+ * WebProcess/WebConnectionToUIProcess.cpp:
+ (WebKit::WebConnectionToUIProcess::encodeMessageBody): Deleted.
+ (WebKit::WebConnectionToUIProcess::decodeMessageBody): Deleted.
+ * WebProcess/WebConnectionToUIProcess.h:
+ Delete more unused members.
+
+2014-12-27 Anders Carlsson <andersca@apple.com>
+
</ins><span class="cx"> Encode and decode WKTypeRefWrapper objects
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=139966
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebConnection.cpp (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebConnection.cpp        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/Shared/WebConnection.cpp        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "ArgumentCoders.h"
</span><span class="cx"> #include "DataReference.h"
</span><ins>+#include "UserData.h"
</ins><span class="cx"> #include "WebConnectionMessages.h"
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="lines">@@ -51,11 +52,7 @@
</span><span class="cx"> if (!hasValidConnection())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto encoder = std::make_unique<IPC::MessageEncoder>(Messages::WebConnection::HandleMessage::receiverName(), Messages::WebConnection::HandleMessage::name(), 0);
- encoder->encode(messageName);
- encodeMessageBody(*encoder, messageBody);
-
- sendMessage(WTF::move(encoder), 0);
</del><ins>+ send(Messages::WebConnection::HandleMessage(messageName, UserData(transformObjectsToHandles(messageBody))));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebConnection::didClose()
</span><span class="lines">@@ -68,17 +65,9 @@
</span><span class="cx"> didReceiveWebConnectionMessage(connection, decoder);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebConnection::handleMessage(IPC::MessageDecoder& decoder)
</del><ins>+void WebConnection::handleMessage(const String& messageName, const UserData& messageBody)
</ins><span class="cx"> {
</span><del>- String messageName;
- if (!decoder.decode(messageName))
- return;
-
- RefPtr<API::Object> messageBody;
- if (!decodeMessageBody(decoder, messageBody))
- return;
-
- m_client.didReceiveMessage(this, messageName, messageBody.get());
</del><ins>+ m_client.didReceiveMessage(this, messageName, transformHandlesToObjects(messageBody.object()).get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebConnection.h (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebConnection.h        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/Shared/WebConnection.h        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -29,11 +29,13 @@
</span><span class="cx"> #include "APIObject.h"
</span><span class="cx"> #include "MessageReceiver.h"
</span><span class="cx"> #include "MessageSender.h"
</span><ins>+#include "UserData.h"
</ins><span class="cx"> #include "WebConnectionClient.h"
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class UserData;
</ins><span class="cx"> class WebConnection : public API::ObjectImpl<API::Object::Type::Connection>, public IPC::MessageReceiver, public IPC::MessageSender {
</span><span class="cx"> public:
</span><span class="cx"> virtual ~WebConnection();
</span><span class="lines">@@ -47,8 +49,6 @@
</span><span class="cx">
</span><span class="cx"> virtual RefPtr<API::Object> transformHandlesToObjects(API::Object*) = 0;
</span><span class="cx"> virtual RefPtr<API::Object> transformObjectsToHandles(API::Object*) = 0;
</span><del>- virtual void encodeMessageBody(IPC::ArgumentEncoder&, API::Object*) = 0;
- virtual bool decodeMessageBody(IPC::ArgumentDecoder&, RefPtr<API::Object>&) = 0;
</del><span class="cx">
</span><span class="cx"> // IPC::MessageReceiver
</span><span class="cx"> void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> void didReceiveWebConnectionMessage(IPC::Connection*, IPC::MessageDecoder&);
</span><span class="cx">
</span><span class="cx"> // Mesage handling implementation functions.
</span><del>- void handleMessage(IPC::MessageDecoder&);
</del><ins>+ void handleMessage(const String& messageName, const UserData& messageBody);
</ins><span class="cx">
</span><span class="cx"> virtual bool hasValidConnection() const = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebConnectionmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebConnection.messages.in (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebConnection.messages.in        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/Shared/WebConnection.messages.in        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -21,5 +21,5 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><span class="cx"> messages -> WebConnection LegacyReceiver {
</span><del>- HandleMessage() Variadic
</del><ins>+ HandleMessage(String messageName, WebKit::UserData messageBody)
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -50,29 +50,16 @@
</span><span class="cx">
</span><span class="cx"> // WebConnection
</span><span class="cx">
</span><del>-RefPtr<API::Object> WebConnectionToWebProcess::transformHandlesToObjects(API::Object*)
</del><ins>+RefPtr<API::Object> WebConnectionToWebProcess::transformHandlesToObjects(API::Object* object)
</ins><span class="cx"> {
</span><del>- // FIXME: Implement.
- return nullptr;
</del><ins>+ return m_process->transformHandlesToObjects(object);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<API::Object> WebConnectionToWebProcess::transformObjectsToHandles(API::Object*)
</del><ins>+RefPtr<API::Object> WebConnectionToWebProcess::transformObjectsToHandles(API::Object* object)
</ins><span class="cx"> {
</span><del>- // FIXME: Implement.
- return nullptr;
</del><ins>+ return m_process->transformObjectsToHandles(object);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebConnectionToWebProcess::encodeMessageBody(IPC::ArgumentEncoder& encoder, API::Object* messageBody)
-{
- encoder << WebContextUserMessageEncoder(messageBody, *m_process);
-}
-
-bool WebConnectionToWebProcess::decodeMessageBody(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& messageBody)
-{
- WebContextUserMessageDecoder messageBodyDecoder(messageBody, *m_process);
- return decoder.decode(messageBodyDecoder);
-}
-
</del><span class="cx"> bool WebConnectionToWebProcess::hasValidConnection() const
</span><span class="cx"> {
</span><span class="cx"> return m_process;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/UIProcess/WebConnectionToWebProcess.h        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -46,8 +46,6 @@
</span><span class="cx"> // WebConnection
</span><span class="cx"> virtual RefPtr<API::Object> transformHandlesToObjects(API::Object*) override;
</span><span class="cx"> virtual RefPtr<API::Object> transformObjectsToHandles(API::Object*) override;
</span><del>- virtual void encodeMessageBody(IPC::ArgumentEncoder&, API::Object*) override;
- virtual bool decodeMessageBody(IPC::ArgumentDecoder&, RefPtr<API::Object>&) override;
</del><span class="cx"> virtual bool hasValidConnection() const override;
</span><span class="cx">
</span><span class="cx"> // IPC::MessageSender
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebConnectionToUIProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.cpp        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">
</span><span class="cx"> void WebConnectionToUIProcess::invalidate()
</span><span class="cx"> {
</span><del>- m_process = 0;
</del><ins>+ m_process = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // WebConnection
</span><span class="lines">@@ -62,17 +62,6 @@
</span><span class="cx"> return m_process->transformObjectsToHandles(object);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebConnectionToUIProcess::encodeMessageBody(IPC::ArgumentEncoder& encoder, API::Object* messageBody)
-{
- encoder << InjectedBundleUserMessageEncoder(messageBody);
-}
-
-bool WebConnectionToUIProcess::decodeMessageBody(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& messageBody)
-{
- InjectedBundleUserMessageDecoder messageBodyDecoder(messageBody);
- return decoder.decode(messageBodyDecoder);
-}
-
</del><span class="cx"> bool WebConnectionToUIProcess::hasValidConnection() const
</span><span class="cx"> {
</span><span class="cx"> return m_process;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebConnectionToUIProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h (177767 => 177768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h        2014-12-27 20:34:35 UTC (rev 177767)
+++ trunk/Source/WebKit2/WebProcess/WebConnectionToUIProcess.h        2014-12-27 20:59:29 UTC (rev 177768)
</span><span class="lines">@@ -44,8 +44,6 @@
</span><span class="cx"> // WebConnection
</span><span class="cx"> virtual RefPtr<API::Object> transformHandlesToObjects(API::Object*) override;
</span><span class="cx"> virtual RefPtr<API::Object> transformObjectsToHandles(API::Object*) override;
</span><del>- virtual void encodeMessageBody(IPC::ArgumentEncoder&, API::Object*) override;
- virtual bool decodeMessageBody(IPC::ArgumentDecoder&, RefPtr<API::Object>&) override;
</del><span class="cx"> virtual bool hasValidConnection() const override;
</span><span class="cx">
</span><span class="cx"> // IPC::MessageSender
</span></span></pre>
</div>
</div>
</body>
</html>