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

Unified Diff: ipc/mojo/ipc_message_pipe_reader.cc

Issue 1809323002: ChannelMojo: Remove intermediate Message struct (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « ipc/mojo/ipc_message_pipe_reader.h ('k') | no next file » | 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 76e323bb72fde5a744ef28e61a7543d31f98ed46..495a3a5d30f6a9b3e6f022d59f3d06963eb0fbc7 100644
--- a/ipc/mojo/ipc_message_pipe_reader.cc
+++ b/ipc/mojo/ipc_message_pipe_reader.cc
@@ -58,33 +58,33 @@ bool MessagePipeReader::Send(scoped_ptr<Message> message) {
"MessagePipeReader::Send",
message->flags(),
TRACE_EVENT_FLAG_FLOW_OUT);
- mojom::MessagePtr ipc_message = mojom::Message::New();
+ mojo::Array<mojom::SerializedHandlePtr> handles(nullptr);
MojoResult result = MOJO_RESULT_OK;
- result = ChannelMojo::ReadFromMessageAttachmentSet(message.get(),
- &ipc_message->handles);
+ result = ChannelMojo::ReadFromMessageAttachmentSet(message.get(), &handles);
if (result != MOJO_RESULT_OK) {
CloseWithError(result);
return false;
}
- ipc_message->data.resize(message->size());
+ mojo::Array<uint8_t> data(message->size());
std::copy(reinterpret_cast<const uint8_t*>(message->data()),
reinterpret_cast<const uint8_t*>(message->data()) + message->size(),
- &ipc_message->data[0]);
- sender_->Receive(std::move(ipc_message));
+ &data[0]);
+ sender_->Receive(std::move(data), std::move(handles));
DVLOG(4) << "Send " << message->type() << ": " << message->size();
return true;
}
-void MessagePipeReader::Receive(mojom::MessagePtr ipc_message) {
- Message message(ipc_message->data.size() == 0
- ? ""
- : reinterpret_cast<const char*>(&ipc_message->data[0]),
- static_cast<uint32_t>(ipc_message->data.size()));
+void MessagePipeReader::Receive(
+ mojo::Array<uint8_t> data,
+ mojo::Array<mojom::SerializedHandlePtr> handles) {
+ Message message(
+ data.size() == 0 ? "" : reinterpret_cast<const char*>(&data[0]),
+ static_cast<uint32_t>(data.size()));
message.set_sender_pid(peer_pid_);
DVLOG(4) << "Receive " << message.type() << ": " << message.size();
- MojoResult write_result = ChannelMojo::WriteToMessageAttachmentSet(
- std::move(ipc_message->handles), &message);
+ MojoResult write_result =
+ ChannelMojo::WriteToMessageAttachmentSet(std::move(handles), &message);
if (write_result != MOJO_RESULT_OK) {
CloseWithError(write_result);
return;
« no previous file with comments | « ipc/mojo/ipc_message_pipe_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698