OLD | NEW |
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" | |
11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" |
12 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 12 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
13 #include "mojo/public/cpp/bindings/lib/serialization.h" | 13 #include "mojo/public/cpp/bindings/lib/serialization.h" |
14 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h" | 14 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace { | 17 namespace { |
18 | 18 |
19 Message ConstructRunOrClosePipeMessage( | 19 Message ConstructRunOrClosePipeMessage( |
20 pipe_control::RunOrClosePipeInputPtr input_ptr) { | 20 pipe_control::RunOrClosePipeInputPtr input_ptr) { |
21 internal::SerializationContext context; | 21 internal::SerializationContext context; |
(...skipping 15 matching lines...) Expand all Loading... |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver) | 40 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver) |
41 : receiver_(receiver) {} | 41 : receiver_(receiver) {} |
42 | 42 |
43 void PipeControlMessageProxy::NotifyPeerEndpointClosed( | 43 void PipeControlMessageProxy::NotifyPeerEndpointClosed( |
44 InterfaceId id, | 44 InterfaceId id, |
45 const base::Optional<DisconnectReason>& reason) { | 45 const base::Optional<DisconnectReason>& reason) { |
46 Message message(ConstructPeerEndpointClosedMessage(id, reason)); | 46 Message message(ConstructPeerEndpointClosedMessage(id, reason)); |
47 bool ok = receiver_->Accept(&message); | 47 ignore_result(receiver_->Accept(&message)); |
48 ALLOW_UNUSED_LOCAL(ok); | |
49 } | 48 } |
50 | 49 |
51 // static | 50 // static |
52 Message PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( | 51 Message PipeControlMessageProxy::ConstructPeerEndpointClosedMessage( |
53 InterfaceId id, | 52 InterfaceId id, |
54 const base::Optional<DisconnectReason>& reason) { | 53 const base::Optional<DisconnectReason>& reason) { |
55 auto event = pipe_control::PeerAssociatedEndpointClosedEvent::New(); | 54 auto event = pipe_control::PeerAssociatedEndpointClosedEvent::New(); |
56 event->id = id; | 55 event->id = id; |
57 if (reason) { | 56 if (reason) { |
58 event->disconnect_reason = pipe_control::DisconnectReason::New(); | 57 event->disconnect_reason = pipe_control::DisconnectReason::New(); |
59 event->disconnect_reason->custom_reason = reason->custom_reason; | 58 event->disconnect_reason->custom_reason = reason->custom_reason; |
60 event->disconnect_reason->description = reason->description; | 59 event->disconnect_reason->description = reason->description; |
61 } | 60 } |
62 | 61 |
63 auto input = pipe_control::RunOrClosePipeInput::New(); | 62 auto input = pipe_control::RunOrClosePipeInput::New(); |
64 input->set_peer_associated_endpoint_closed_event(std::move(event)); | 63 input->set_peer_associated_endpoint_closed_event(std::move(event)); |
65 | 64 |
66 return ConstructRunOrClosePipeMessage(std::move(input)); | 65 return ConstructRunOrClosePipeMessage(std::move(input)); |
67 } | 66 } |
68 | 67 |
69 } // namespace mojo | 68 } // namespace mojo |
OLD | NEW |