Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Unified Diff: ipc/ipc_channel_reader.cc

Issue 1308613006: ipc: Update Message::FindNext to parse brokered attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ipc/ipc_message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | ipc/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698