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

Unified Diff: mojo/public/cpp/bindings/lib/connector.cc

Issue 1932083002: Mojo: Use new message APIs to reduce copying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: mojo/public/cpp/bindings/lib/connector.cc
diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc
index 1d25640c0a5006840778e5d4267867e380101d14..9f1037ceae81b09ef3948d6532b7f1cec9a524ff 100644
--- a/mojo/public/cpp/bindings/lib/connector.cc
+++ b/mojo/public/cpp/bindings/lib/connector.cc
@@ -150,20 +150,9 @@ bool Connector::Accept(Message* message) {
return true;
MojoResult rv =
- WriteMessageRaw(message_pipe_.get(),
- message->data(),
- message->data_num_bytes(),
- message->mutable_handles()->empty()
- ? nullptr
- : reinterpret_cast<const MojoHandle*>(
- &message->mutable_handles()->front()),
- static_cast<uint32_t>(message->mutable_handles()->size()),
+ WriteMessageNew(message_pipe_.get(), message->TakeMojoMessage(),
MOJO_WRITE_MESSAGE_FLAG_NONE);
- // The handles are always either transferred or closed, so we don't need the
- // message to track their lifetime any longer.
- message->mutable_handles()->clear();
-
switch (rv) {
case MOJO_RESULT_OK:
break;

Powered by Google App Engine
This is Rietveld 408576698