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

Side by Side Diff: mojo/public/cpp/bindings/lib/pipe_control_message_proxy.cc

Issue 2766523002: mojo: MessageReceiver*::AcceptWithResponder() now take a unique_ptr to the responder (Closed)
Patch Set: fix mac compile, use ignore_result more Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h" 5 #include "mojo/public/cpp/bindings/pipe_control_message_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
yzshen1 2017/03/21 16:10:00 Is this still needed?
watk 2017/03/22 07:09:15 Removed, thanks
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h"
12 #include "mojo/public/cpp/bindings/lib/message_builder.h" 13 #include "mojo/public/cpp/bindings/lib/message_builder.h"
13 #include "mojo/public/cpp/bindings/lib/serialization.h" 14 #include "mojo/public/cpp/bindings/lib/serialization.h"
14 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h" 15 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace { 18 namespace {
18 19
19 Message ConstructRunOrClosePipeMessage( 20 Message ConstructRunOrClosePipeMessage(
20 pipe_control::RunOrClosePipeInputPtr input_ptr) { 21 pipe_control::RunOrClosePipeInputPtr input_ptr) {
21 internal::SerializationContext context; 22 internal::SerializationContext context;
(...skipping 15 matching lines...) Expand all
37 38
38 } // namespace 39 } // namespace
39 40
40 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver) 41 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver)
41 : receiver_(receiver) {} 42 : receiver_(receiver) {}
42 43
43 void PipeControlMessageProxy::NotifyPeerEndpointClosed( 44 void PipeControlMessageProxy::NotifyPeerEndpointClosed(
44 InterfaceId id, 45 InterfaceId id,
45 const base::Optional<DisconnectReason>& reason) { 46 const base::Optional<DisconnectReason>& reason) {
46 Message message(ConstructPeerEndpointClosedMessage(id, reason)); 47 Message message(ConstructPeerEndpointClosedMessage(id, reason));
47 bool ok = receiver_->Accept(&message); 48 ignore_result(receiver_->Accept(&message));
48 ALLOW_UNUSED_LOCAL(ok);
49 } 49 }
50 50
51 // static 51 // static
52 Message PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( 52 Message PipeControlMessageProxy::ConstructPeerEndpointClosedMessage(
53 InterfaceId id, 53 InterfaceId id,
54 const base::Optional<DisconnectReason>& reason) { 54 const base::Optional<DisconnectReason>& reason) {
55 auto event = pipe_control::PeerAssociatedEndpointClosedEvent::New(); 55 auto event = pipe_control::PeerAssociatedEndpointClosedEvent::New();
56 event->id = id; 56 event->id = id;
57 if (reason) { 57 if (reason) {
58 event->disconnect_reason = pipe_control::DisconnectReason::New(); 58 event->disconnect_reason = pipe_control::DisconnectReason::New();
59 event->disconnect_reason->custom_reason = reason->custom_reason; 59 event->disconnect_reason->custom_reason = reason->custom_reason;
60 event->disconnect_reason->description = reason->description; 60 event->disconnect_reason->description = reason->description;
61 } 61 }
62 62
63 auto input = pipe_control::RunOrClosePipeInput::New(); 63 auto input = pipe_control::RunOrClosePipeInput::New();
64 input->set_peer_associated_endpoint_closed_event(std::move(event)); 64 input->set_peer_associated_endpoint_closed_event(std::move(event));
65 65
66 return ConstructRunOrClosePipeMessage(std::move(input)); 66 return ConstructRunOrClosePipeMessage(std::move(input));
67 } 67 }
68 68
69 } // namespace mojo 69 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698