Index: ipc/ipc_channel_reader.cc |
diff --git a/ipc/ipc_channel_reader.cc b/ipc/ipc_channel_reader.cc |
index a76b7e654b30a7a575e8350774a27288da43b931..bca3ddcf7ac87ead2c53f5279b688cb110a2d71d 100644 |
--- a/ipc/ipc_channel_reader.cc |
+++ b/ipc/ipc_channel_reader.cc |
@@ -85,11 +85,15 @@ bool ChannelReader::TranslateInputData(const char* input_data, |
// Dispatch all complete messages in the data buffer. |
while (p < end) { |
- const char* message_tail = Message::FindNext(p, end); |
- if (message_tail) { |
- int len = static_cast<int>(message_tail - p); |
+ Message::NextMessageInfo info; |
+ Message::FindNext(p, end, &info); |
+ if (info.message_found) { |
+ int pickle_len = static_cast<int>(info.pickle_end - p); |
+ Message translated_message(p, pickle_len); |
+ |
+ // TODO(erikchen): Make attachments for info.attachment_ids. |
+ // http://crbug.com/493414. |
- Message translated_message(p, len); |
if (!GetNonBrokeredAttachments(&translated_message)) |
return false; |
@@ -103,7 +107,7 @@ bool ChannelReader::TranslateInputData(const char* input_data, |
if (blocked_ids.empty()) { |
// Dispatch the message and continue the loop. |
DispatchMessage(&translated_message); |
- p = message_tail; |
+ p = info.message_end; |
continue; |
} |
@@ -114,7 +118,7 @@ bool ChannelReader::TranslateInputData(const char* input_data, |
// Make a deep copy of |translated_message| to add to the queue. |
scoped_ptr<Message> m(new Message(translated_message)); |
queued_messages_.push_back(m.release()); |
- p = message_tail; |
+ p = info.message_end; |
} else { |
// Last message is partial. |
break; |