[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [58618] trunk/WebKit2
From:       weinig () apple ! com
Date:       2010-04-30 23:06:46
Message-ID: 20100430230646.C37F1486BCFA () beta ! macosforge ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!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>[58618] trunk/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/58618">58618</a></dd> \
<dt>Author</dt> <dd>weinig@apple.com</dd> <dt>Date</dt> <dd>2010-04-30 16:06:45 -0700 \
(Fri, 30 Apr 2010)</dd> </dl>

<h3>Log Message</h3>
<pre>Fix for https://bugs.webkit.org/show_bug.cgi?id=38406
Add support for sending messages with a size greater than 4096 bytes

Reviewed by Anders Carlsson.

Adds support by putting message bodies that are larger than 4096 bytes
in OOL memory.

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::sendMessage):
(CoreIPC::Connection::waitForMessage):
(CoreIPC::Connection::sendSyncMessage):
(CoreIPC::Connection::dispatchMessages):
* Platform/CoreIPC/Connection.h:
(CoreIPC::Connection::OutgoingMessage::OutgoingMessage):
(CoreIPC::Connection::OutgoingMessage::messageID):
(CoreIPC::Connection::send):
(CoreIPC::Connection::sendSync):
* Platform/CoreIPC/MessageID.h:
(CoreIPC::MessageID::):
(CoreIPC::MessageID::MessageID):
(CoreIPC::MessageID::equalIgnoringFlags):
(CoreIPC::MessageID::copyAddingFlags):
(CoreIPC::MessageID::fromInt):
(CoreIPC::MessageID::toInt):
(CoreIPC::MessageID::isMessageBodyOOL):
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::sendOutgoingMessage):
(CoreIPC::createArgumentDecoder):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKit2ChangeLog">trunk/WebKit2/ChangeLog</a></li>
<li><a href="#trunkWebKit2PlatformCoreIPCConnectioncpp">trunk/WebKit2/Platform/CoreIPC/Connection.cpp</a></li>
 <li><a href="#trunkWebKit2PlatformCoreIPCConnectionh">trunk/WebKit2/Platform/CoreIPC/Connection.h</a></li>
 <li><a href="#trunkWebKit2PlatformCoreIPCMessageIDh">trunk/WebKit2/Platform/CoreIPC/MessageID.h</a></li>
 <li><a href="#trunkWebKit2PlatformCoreIPCmacConnectionMaccpp">trunk/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit2/ChangeLog (58617 => 58618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit2/ChangeLog	2010-04-30 23:00:48 UTC (rev 58617)
+++ trunk/WebKit2/ChangeLog	2010-04-30 23:06:45 UTC (rev 58618)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2010-04-30  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Reviewed by Anders Carlsson.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=38406
+        Add support for sending messages with a size greater than 4096 bytes
+
+        Adds support by putting message bodies that are larger than 4096 bytes
+        in OOL memory.
+
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::sendMessage):
+        (CoreIPC::Connection::waitForMessage):
+        (CoreIPC::Connection::sendSyncMessage):
+        (CoreIPC::Connection::dispatchMessages):
+        * Platform/CoreIPC/Connection.h:
+        (CoreIPC::Connection::OutgoingMessage::OutgoingMessage):
+        (CoreIPC::Connection::OutgoingMessage::messageID):
+        (CoreIPC::Connection::send):
+        (CoreIPC::Connection::sendSync):
+        * Platform/CoreIPC/MessageID.h:
+        (CoreIPC::MessageID::):
+        (CoreIPC::MessageID::MessageID):
+        (CoreIPC::MessageID::equalIgnoringFlags):
+        (CoreIPC::MessageID::copyAddingFlags):
+        (CoreIPC::MessageID::fromInt):
+        (CoreIPC::MessageID::toInt):
+        (CoreIPC::MessageID::isMessageBodyOOL):
+        * Platform/CoreIPC/mac/ConnectionMac.cpp:
+        (CoreIPC::Connection::sendOutgoingMessage):
+        (CoreIPC::createArgumentDecoder):
+
</ins><span class="cx"> 2010-04-28  Mike Thole  &lt;mthole@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix, not reviewed.
</span></span></pre></div>
<a id="trunkWebKit2PlatformCoreIPCConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit2/Platform/CoreIPC/Connection.cpp \
(58617 => 58618)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebKit2/Platform/CoreIPC/Connection.cpp	2010-04-30 \
                23:00:48 UTC (rev 58617)
+++ trunk/WebKit2/Platform/CoreIPC/Connection.cpp	2010-04-30 23:06:45 UTC (rev 58618)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">     m_connectionQueue.scheduleWork(WorkItem::create(this, \
&amp;Connection::platformInvalidate)); </span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Connection::sendMessage(unsigned messageID, \
auto_ptr&lt;ArgumentEncoder&gt; arguments) </del><ins>+bool \
Connection::sendMessage(MessageID messageID, auto_ptr&lt;ArgumentEncoder&gt; \
arguments) </ins><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="cx">         return false;
</span><span class="lines">@@ -98,8 +98,8 @@
</span><span class="cx"> 
</span><span class="cx">         for (size_t i = 0; i &lt; m_incomingMessages.size(); \
++i) { </span><span class="cx">             const IncomingMessage&amp; message = \
m_incomingMessages[i]; </span><del>-    
-            if (message.messageID() == messageID &amp;&amp; \
message.arguments()-&gt;destinationID() == destinationID) { </del><ins>+
+            if (equalIgnoringFlags(message.messageID(), messageID) &amp;&amp; \
message.arguments()-&gt;destinationID() == destinationID) { </ins><span class="cx">   \
std::auto_ptr&lt;ArgumentDecoder&gt; arguments(message.arguments()); </span><span \
class="cx">                  </span><span class="cx">                 // Erase the \
incoming message. </span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">     return std::auto_ptr&lt;ArgumentDecoder&gt;();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::auto_ptr&lt;ArgumentDecoder&gt; \
Connection::sendSyncMessage(unsigned messageID, uint64_t syncRequestID, \
std::auto_ptr&lt;ArgumentEncoder&gt; encoder, double timeout) \
</del><ins>+std::auto_ptr&lt;ArgumentDecoder&gt; \
Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, \
std::auto_ptr&lt;ArgumentEncoder&gt; encoder, double timeout) </ins><span class="cx"> \
{ </span><span class="cx">     // First send the message.
</span><span class="cx">     if (!sendMessage(messageID, encoder))
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">             m_client-&gt;didReceiveSyncMessage(this, \
message.messageID(), arguments, replyEncoder.get()); </span><span class="cx">         \
 </span><span class="cx">             // Send the reply.
</span><del>-            \
sendMessage(MessageID(CoreIPCMessage::SyncMessageReply).toInt(), replyEncoder); \
</del><ins>+            sendMessage(MessageID(CoreIPCMessage::SyncMessageReply), \
replyEncoder); </ins><span class="cx">         } else
</span><span class="cx">             m_client-&gt;didReceiveMessage(this, \
message.messageID(), arguments); </span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebKit2PlatformCoreIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/WebKit2/Platform/CoreIPC/Connection.h (58617 \
=> 58618)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebKit2/Platform/CoreIPC/Connection.h	2010-04-30 \
                23:00:48 UTC (rev 58617)
+++ trunk/WebKit2/Platform/CoreIPC/Connection.h	2010-04-30 23:06:45 UTC (rev 58618)
</span><span class="lines">@@ -86,14 +86,14 @@
</span><span class="cx">     
</span><span class="cx">     bool isValid() const { return m_client; }
</span><span class="cx">     
</span><del>-    bool sendMessage(unsigned messageID, \
                std::auto_ptr&lt;ArgumentEncoder&gt;);
-    std::auto_ptr&lt;ArgumentDecoder&gt; sendSyncMessage(unsigned messageID, \
                uint64_t syncRequestID, std::auto_ptr&lt;ArgumentEncoder&gt;, double \
                timeout);
-    std::auto_ptr&lt;ArgumentDecoder&gt; waitForMessage(MessageID messageID, \
uint64_t destinationID, double timeout); </del><ins>+    bool sendMessage(MessageID, \
std::auto_ptr&lt;ArgumentEncoder&gt;); +    std::auto_ptr&lt;ArgumentDecoder&gt; \
sendSyncMessage(MessageID, uint64_t syncRequestID, \
std::auto_ptr&lt;ArgumentEncoder&gt;, double timeout); +    \
std::auto_ptr&lt;ArgumentDecoder&gt; waitForMessage(MessageID, uint64_t \
destinationID, double timeout); </ins><span class="cx">     
</span><span class="cx">     // Called on the connection work queue.
</span><span class="cx">     void processIncomingMessage(MessageID, \
std::auto_ptr&lt;ArgumentDecoder&gt;); </span><span class="cx">     void \
sendOutgoingMessages(); </span><del>-    void sendOutgoingMessage(unsigned messageID, \
std::auto_ptr&lt;ArgumentEncoder&gt;); </del><ins>+    void \
sendOutgoingMessage(MessageID, std::auto_ptr&lt;ArgumentEncoder&gt;); </ins><span \
class="cx">     void connectionDidClose(); </span><span class="cx">     
</span><span class="cx">     // Called on the listener thread.
</span><span class="lines">@@ -136,13 +136,13 @@
</span><span class="cx">     // Outgoing messages.
</span><span class="cx">     class OutgoingMessage {
</span><span class="cx">     public:
</span><del>-        OutgoingMessage(unsigned messageID, \
std::auto_ptr&lt;ArgumentEncoder&gt; arguments) </del><ins>+        \
OutgoingMessage(MessageID messageID, std::auto_ptr&lt;ArgumentEncoder&gt; arguments) \
</ins><span class="cx">             : m_messageID(messageID) </span><span class="cx"> \
, m_arguments(arguments.release()) </span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        unsigned messageID() const { return m_messageID; }
</del><ins>+        MessageID messageID() const { return m_messageID; }
</ins><span class="cx">         ArgumentEncoder* arguments() const { return \
m_arguments; } </span><span class="cx">         
</span><span class="cx">         void destroy()
</span><span class="lines">@@ -151,7 +151,7 @@
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">     private:
</span><del>-        unsigned m_messageID;
</del><ins>+        MessageID m_messageID;
</ins><span class="cx">         ArgumentEncoder* m_arguments;
</span><span class="cx">     };
</span><span class="cx">     
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">     std::auto_ptr&lt;ArgumentEncoder&gt; argumentEncoder(new \
ArgumentEncoder(destinationID)); </span><span class="cx">     \
argumentEncoder-&gt;encode(arguments); </span><span class="cx"> 
</span><del>-    return sendMessage(MessageID(messageID).toInt(), argumentEncoder);
</del><ins>+    return sendMessage(MessageID(messageID), argumentEncoder);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename E, typename T, typename U&gt;
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx">     argumentEncoder-&gt;encode(arguments);
</span><span class="cx">     
</span><span class="cx">     // Now send the message and wait for a reply.
</span><del>-    std::auto_ptr&lt;ArgumentDecoder&gt; replyDecoder = \
sendSyncMessage(MessageID(messageID).toInt(MessageID::SyncMessage), syncRequestID, \
argumentEncoder, timeout); </del><ins>+    std::auto_ptr&lt;ArgumentDecoder&gt; \
replyDecoder = sendSyncMessage(MessageID(messageID, MessageID::SyncMessage), \
syncRequestID, argumentEncoder, timeout); </ins><span class="cx">     if \
(!replyDecoder.get()) </span><span class="cx">         return false;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkWebKit2PlatformCoreIPCMessageIDh"></a>
<div class="modfile"><h4>Modified: trunk/WebKit2/Platform/CoreIPC/MessageID.h (58617 \
=> 58618)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebKit2/Platform/CoreIPC/MessageID.h	2010-04-30 23:00:48 \
                UTC (rev 58617)
+++ trunk/WebKit2/Platform/CoreIPC/MessageID.h	2010-04-30 23:06:45 UTC (rev 58618)
</span><span class="lines">@@ -64,12 +64,13 @@
</span><span class="cx"> class MessageID {
</span><span class="cx"> public:
</span><span class="cx">     enum Flags {
</span><del>-        SyncMessage = 1
</del><ins>+        SyncMessage = 1 &lt;&lt; 0,
+        MessageBodyIsOOL = 1 &lt;&lt; 1
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     template &lt;typename EnumType&gt;
</span><del>-    explicit MessageID(EnumType messageKind)
-        : m_messageID((MessageKindTraits&lt;EnumType&gt;::messageClass) &lt;&lt; 16 \
| messageKind) </del><ins>+    explicit MessageID(EnumType messageKind, unsigned char \
flags = 0) +        : m_messageID(flags &lt;&lt; 24 | \
(MessageKindTraits&lt;EnumType&gt;::messageClass) &lt;&lt; 16 | messageKind) \
</ins><span class="cx">     { </span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -91,18 +92,17 @@
</span><span class="cx">     {
</span><span class="cx">         return (m_messageID &amp; 0xffffff) == \
(MessageID(messageKind).m_messageID &amp; 0xffffff); </span><span class="cx">     }
</span><del>-    
-    static MessageID fromInt(unsigned i)
</del><ins>+
+    MessageID copyAddingFlags(unsigned char flags)
</ins><span class="cx">     {
</span><del>-        MessageID messageID;
-        
-        messageID.m_messageID = i;
-        return messageID;
</del><ins>+        return MessageID(Encoded, flags &lt;&lt; 24 | m_messageID);
</ins><span class="cx">     }
</span><del>-    
-    unsigned toInt(unsigned char flags = 0) const { return (flags &lt;&lt; 24) | \
m_messageID; } </del><span class="cx"> 
</span><ins>+    static MessageID fromInt(unsigned i) { return MessageID(Encoded, i); \
} +    unsigned toInt() const { return m_messageID; }
+
</ins><span class="cx">     bool isSync() const { return getFlags() &amp; \
SyncMessage; } </span><ins>+    bool isMessageBodyOOL() const { return getFlags() \
&amp; MessageBodyIsOOL; } </ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     unsigned char getFlags() const { return (m_messageID \
&amp; 0xff000000) &gt;&gt; 24; } </span><span class="lines">@@ -112,10 +112,21 @@
</span><span class="cx">         : m_messageID(0)
</span><span class="cx">     {
</span><span class="cx">     }
</span><ins>+
+    enum EncodedTag { Encoded };
+    MessageID(EncodedTag, unsigned messageID)
+        : m_messageID(messageID)
+    {
+    }
</ins><span class="cx">     
</span><span class="cx">     unsigned m_messageID;
</span><span class="cx"> };
</span><del>-    
</del><ins>+
+inline bool equalIgnoringFlags(MessageID a, MessageID b)
+{
+    return (a.toInt() &amp; 0xffffff) == (b.toInt() &amp; 0xffffff);
+}
+
</ins><span class="cx"> } // namespace CoreIPC
</span><span class="cx">     
</span><span class="cx"> #endif // MessageID_h
</span></span></pre></div>
<a id="trunkWebKit2PlatformCoreIPCmacConnectionMaccpp"></a>
<div class="modfile"><h4>Modified: \
trunk/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp (58617 => 58618)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp	2010-04-30 23:00:48 UTC (rev \
                58617)
+++ trunk/WebKit2/Platform/CoreIPC/mac/ConnectionMac.cpp	2010-04-30 23:06:45 UTC (rev \
58618) </span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx">     return round_msg(size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Connection::sendOutgoingMessage(unsigned messageID, \
auto_ptr&lt;ArgumentEncoder&gt; arguments) </del><ins>+void \
Connection::sendOutgoingMessage(MessageID messageID, auto_ptr&lt;ArgumentEncoder&gt; \
arguments) </ins><span class="cx"> {
</span><span class="cx">     Vector&lt;Attachment&gt; attachments = \
arguments-&gt;releaseAttachments(); </span><span class="cx">     
</span><span class="lines">@@ -125,9 +125,15 @@
</span><span class="cx">     
</span><span class="cx">     char buffer[inlineMessageMaxSize];
</span><span class="cx"> 
</span><ins>+    bool messageBodyIsOOL = false;
</ins><span class="cx">     if (messageSize &gt; sizeof(buffer)) {
</span><del>-        // FIXME: The message should be OOL.
-        ASSERT(false);
</del><ins>+        messageBodyIsOOL = true;
+
+        attachments.append(Attachment(arguments-&gt;buffer(), \
arguments-&gt;bufferSize(), MACH_MSG_VIRTUAL_COPY, false)); +        \
numberOfOOLMemoryDescriptors++; +        messageSize = machMessageSize(0, \
numberOfPortDescriptors, numberOfOOLMemoryDescriptors); +
+        messageID = messageID.copyAddingFlags(MessageID::MessageBodyIsOOL);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool isComplex = (numberOfPortDescriptors + \
numberOfOOLMemoryDescriptors &gt; 0); </span><span class="lines">@@ -137,7 +143,7 @@
</span><span class="cx">     header-&gt;msgh_size = messageSize;
</span><span class="cx">     header-&gt;msgh_remote_port = m_sendPort;
</span><span class="cx">     header-&gt;msgh_local_port = MACH_PORT_NULL;
</span><del>-    header-&gt;msgh_id = messageID;
</del><ins>+    header-&gt;msgh_id = messageID.toInt();
</ins><span class="cx"> 
</span><span class="cx">     uint8_t* messageData;
</span><span class="cx"> 
</span><span class="lines">@@ -176,8 +182,9 @@
</span><span class="cx">     } else
</span><span class="cx">         messageData = (uint8_t*)(header + 1);
</span><span class="cx"> 
</span><del>-    // Copy the data.
-    memcpy(messageData, arguments-&gt;buffer(), arguments-&gt;bufferSize());
</del><ins>+    // Copy the data if it is not being sent out-of-line.
+    if (!messageBodyIsOOL)
+        memcpy(messageData, arguments-&gt;buffer(), arguments-&gt;bufferSize());
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(m_sendPort);
</span><span class="cx">     
</span><span class="lines">@@ -204,6 +211,8 @@
</span><span class="cx">         return auto_ptr&lt;ArgumentDecoder&gt;(new \
ArgumentDecoder(body, bodySize)); </span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    MessageID messageID = MessageID::fromInt(header-&gt;msgh_id);
+
</ins><span class="cx">     mach_msg_body_t* body = \
reinterpret_cast&lt;mach_msg_body_t*&gt;(header + 1); </span><span class="cx">     \
mach_msg_size_t numDescriptors = body-&gt;msgh_descriptor_count; </span><span \
class="cx">     ASSERT(numDescriptors); </span><span class="lines">@@ -211,6 +220,12 \
@@ </span><span class="cx">     // Build attachment list
</span><span class="cx">     Deque&lt;Attachment&gt; attachments;
</span><span class="cx">     uint8_t* descriptorData = \
reinterpret_cast&lt;uint8_t*&gt;(body + 1); </span><ins>+
+    // If the message body was sent out-of-line, don't treat the last descriptor
+    // as an attachment, since it is really the message body.
+    if (messageID.isMessageBodyOOL())
+        --numDescriptors;
+
</ins><span class="cx">     for (mach_msg_size_t i = 0; i &lt; numDescriptors; ++i) {
</span><span class="cx">         mach_msg_descriptor_t* descriptor = \
reinterpret_cast&lt;mach_msg_descriptor_t*&gt;(descriptorData); </span><span \
class="cx">  </span><span class="lines">@@ -229,6 +244,27 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (messageID.isMessageBodyOOL()) {
+        mach_msg_descriptor_t* descriptor = \
reinterpret_cast&lt;mach_msg_descriptor_t*&gt;(descriptorData); +        \
ASSERT(descriptor-&gt;type.type == MACH_MSG_OOL_DESCRIPTOR); +        Attachment \
messageBodyAttachment(descriptor-&gt;out_of_line.address, \
descriptor-&gt;out_of_line.size, +                                         \
descriptor-&gt;out_of_line.copy, descriptor-&gt;out_of_line.deallocate); +
+        uint8_t* messageBody = \
static_cast&lt;uint8_t*&gt;(messageBodyAttachment.address()); +        size_t \
messageBodySize = messageBodyAttachment.size(); +
+        ArgumentDecoder* argumentDecoder;
+
+        if (attachments.isEmpty())
+            argumentDecoder = new ArgumentDecoder(messageBody, messageBodySize);
+        else
+            argumentDecoder = new ArgumentDecoder(messageBody, messageBodySize, \
attachments); +
+        vm_deallocate(mach_task_self(), \
reinterpret_cast&lt;vm_address_t&gt;(messageBodyAttachment.address()), \
messageBodyAttachment.size()); +
+        return auto_ptr&lt;ArgumentDecoder&gt;(argumentDecoder);
+    }
+
</ins><span class="cx">     uint8_t* messageBody = descriptorData;
</span><span class="cx">     size_t messageBodySize = header-&gt;msgh_size - \
(descriptorData - reinterpret_cast&lt;uint8_t*&gt;(header)); </span><span class="cx"> \
 </span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic