[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 <sam@webkit.org>
+
+ 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 <mthole@apple.com>
</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, \
&Connection::platformInvalidate)); </span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Connection::sendMessage(unsigned messageID, \
auto_ptr<ArgumentEncoder> arguments) </del><ins>+bool \
Connection::sendMessage(MessageID messageID, auto_ptr<ArgumentEncoder> \
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 < m_incomingMessages.size(); \
++i) { </span><span class="cx"> const IncomingMessage& message = \
m_incomingMessages[i]; </span><del>-
- if (message.messageID() == messageID && \
message.arguments()->destinationID() == destinationID) { </del><ins>+
+ if (equalIgnoringFlags(message.messageID(), messageID) && \
message.arguments()->destinationID() == destinationID) { </ins><span class="cx"> \
std::auto_ptr<ArgumentDecoder> 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<ArgumentDecoder>();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::auto_ptr<ArgumentDecoder> \
Connection::sendSyncMessage(unsigned messageID, uint64_t syncRequestID, \
std::auto_ptr<ArgumentEncoder> encoder, double timeout) \
</del><ins>+std::auto_ptr<ArgumentDecoder> \
Connection::sendSyncMessage(MessageID messageID, uint64_t syncRequestID, \
std::auto_ptr<ArgumentEncoder> 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->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->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<ArgumentEncoder>);
- std::auto_ptr<ArgumentDecoder> sendSyncMessage(unsigned messageID, \
uint64_t syncRequestID, std::auto_ptr<ArgumentEncoder>, double \
timeout);
- std::auto_ptr<ArgumentDecoder> waitForMessage(MessageID messageID, \
uint64_t destinationID, double timeout); </del><ins>+ bool sendMessage(MessageID, \
std::auto_ptr<ArgumentEncoder>); + std::auto_ptr<ArgumentDecoder> \
sendSyncMessage(MessageID, uint64_t syncRequestID, \
std::auto_ptr<ArgumentEncoder>, double timeout); + \
std::auto_ptr<ArgumentDecoder> 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<ArgumentDecoder>); </span><span class="cx"> void \
sendOutgoingMessages(); </span><del>- void sendOutgoingMessage(unsigned messageID, \
std::auto_ptr<ArgumentEncoder>); </del><ins>+ void \
sendOutgoingMessage(MessageID, std::auto_ptr<ArgumentEncoder>); </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<ArgumentEncoder> arguments) </del><ins>+ \
OutgoingMessage(MessageID messageID, std::auto_ptr<ArgumentEncoder> 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<ArgumentEncoder> argumentEncoder(new \
ArgumentEncoder(destinationID)); </span><span class="cx"> \
argumentEncoder->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<typename E, typename T, typename U>
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx"> argumentEncoder->encode(arguments);
</span><span class="cx">
</span><span class="cx"> // Now send the message and wait for a reply.
</span><del>- std::auto_ptr<ArgumentDecoder> replyDecoder = \
sendSyncMessage(MessageID(messageID).toInt(MessageID::SyncMessage), syncRequestID, \
argumentEncoder, timeout); </del><ins>+ std::auto_ptr<ArgumentDecoder> \
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 << 0,
+ MessageBodyIsOOL = 1 << 1
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template <typename EnumType>
</span><del>- explicit MessageID(EnumType messageKind)
- : m_messageID((MessageKindTraits<EnumType>::messageClass) << 16 \
| messageKind) </del><ins>+ explicit MessageID(EnumType messageKind, unsigned char \
flags = 0) + : m_messageID(flags << 24 | \
(MessageKindTraits<EnumType>::messageClass) << 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 & 0xffffff) == \
(MessageID(messageKind).m_messageID & 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 << 24 | m_messageID);
</ins><span class="cx"> }
</span><del>-
- unsigned toInt(unsigned char flags = 0) const { return (flags << 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() & \
SyncMessage; } </span><ins>+ bool isMessageBodyOOL() const { return getFlags() \
& MessageBodyIsOOL; } </ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> unsigned char getFlags() const { return (m_messageID \
& 0xff000000) >> 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() & 0xffffff) == (b.toInt() & 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<ArgumentEncoder> arguments) </del><ins>+void \
Connection::sendOutgoingMessage(MessageID messageID, auto_ptr<ArgumentEncoder> \
arguments) </ins><span class="cx"> {
</span><span class="cx"> Vector<Attachment> attachments = \
arguments->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 > sizeof(buffer)) {
</span><del>- // FIXME: The message should be OOL.
- ASSERT(false);
</del><ins>+ messageBodyIsOOL = true;
+
+ attachments.append(Attachment(arguments->buffer(), \
arguments->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 > 0); </span><span class="lines">@@ -137,7 +143,7 @@
</span><span class="cx"> header->msgh_size = messageSize;
</span><span class="cx"> header->msgh_remote_port = m_sendPort;
</span><span class="cx"> header->msgh_local_port = MACH_PORT_NULL;
</span><del>- header->msgh_id = messageID;
</del><ins>+ header->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->buffer(), arguments->bufferSize());
</del><ins>+ // Copy the data if it is not being sent out-of-line.
+ if (!messageBodyIsOOL)
+ memcpy(messageData, arguments->buffer(), arguments->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<ArgumentDecoder>(new \
ArgumentDecoder(body, bodySize)); </span><span class="cx"> }
</span><span class="cx">
</span><ins>+ MessageID messageID = MessageID::fromInt(header->msgh_id);
+
</ins><span class="cx"> mach_msg_body_t* body = \
reinterpret_cast<mach_msg_body_t*>(header + 1); </span><span class="cx"> \
mach_msg_size_t numDescriptors = body->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<Attachment> attachments;
</span><span class="cx"> uint8_t* descriptorData = \
reinterpret_cast<uint8_t*>(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 < numDescriptors; ++i) {
</span><span class="cx"> mach_msg_descriptor_t* descriptor = \
reinterpret_cast<mach_msg_descriptor_t*>(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<mach_msg_descriptor_t*>(descriptorData); + \
ASSERT(descriptor->type.type == MACH_MSG_OOL_DESCRIPTOR); + Attachment \
messageBodyAttachment(descriptor->out_of_line.address, \
descriptor->out_of_line.size, + \
descriptor->out_of_line.copy, descriptor->out_of_line.deallocate); +
+ uint8_t* messageBody = \
static_cast<uint8_t*>(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<vm_address_t>(messageBodyAttachment.address()), \
messageBodyAttachment.size()); +
+ return auto_ptr<ArgumentDecoder>(argumentDecoder);
+ }
+
</ins><span class="cx"> uint8_t* messageBody = descriptorData;
</span><span class="cx"> size_t messageBodySize = header->msgh_size - \
(descriptorData - reinterpret_cast<uint8_t*>(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