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

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

Issue 1880823005: [mojo-edk] Add explicit message object APIs (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 938cdc99706eeee396161fcfde7c2ab4a593ee21..1d25640c0a5006840778e5d4267867e380101d14 100644
--- a/mojo/public/cpp/bindings/lib/connector.cc
+++ b/mojo/public/cpp/bindings/lib/connector.cc
@@ -160,11 +160,12 @@ bool Connector::Accept(Message* message) {
static_cast<uint32_t>(message->mutable_handles()->size()),
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:
- // The handles were successfully transferred, so we don't need the message
- // to track their lifetime any longer.
- message->mutable_handles()->clear();
break;
case MOJO_RESULT_FAILED_PRECONDITION:
// There's no point in continuing to write to this pipe since the other

Powered by Google App Engine
This is Rietveld 408576698