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

Unified Diff: ipc/mojo/ipc_message_pipe_reader.cc

Issue 1932083002: Mojo: Use new message APIs to reduce copying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 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 | mojo/mojo_public.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_message_pipe_reader.cc
diff --git a/ipc/mojo/ipc_message_pipe_reader.cc b/ipc/mojo/ipc_message_pipe_reader.cc
index de5726d9e02e937960d795deb86833b685a1320d..0335335a3b38c1cf7fcaf6cb5605fe1358d0971a 100644
--- a/ipc/mojo/ipc_message_pipe_reader.cc
+++ b/ipc/mojo/ipc_message_pipe_reader.cc
@@ -108,15 +108,8 @@ bool MessagePipeReader::Send(std::unique_ptr<Message> message) {
DCHECK_LE(num_handles, std::numeric_limits<uint32_t>::max());
mojo_message->set_interface_id(sender_interface_id_);
- result = mojo::WriteMessageRaw(
- sender_pipe_, mojo_message->data(), mojo_message->data_num_bytes(),
- reinterpret_cast<const MojoHandle*>(mojo_message->handles()->data()),
- static_cast<uint32_t>(num_handles), MOJO_WRITE_MESSAGE_FLAG_NONE);
-
- // If the write was successful, the handles have been transferred and they
- // should not be closed when the message is destroyed.
- if (result == MOJO_RESULT_OK)
- mojo_message->mutable_handles()->clear();
+ result = mojo::WriteMessageNew(sender_pipe_, mojo_message->TakeMojoMessage(),
+ MOJO_WRITE_MESSAGE_FLAG_NONE);
DVLOG(4) << "Send " << message->type() << ": " << message->size();
return result == MOJO_RESULT_OK;
« no previous file with comments | « no previous file | mojo/mojo_public.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698