| 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/lib/pipe_control_message_proxy.h" | 5 #include "mojo/public/cpp/bindings/lib/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" |
| 11 #include "base/logging.h" |
| 11 #include "mojo/public/cpp/bindings/lib/message_builder.h" | 12 #include "mojo/public/cpp/bindings/lib/message_builder.h" |
| 12 #include "mojo/public/cpp/bindings/lib/serialization.h" | 13 #include "mojo/public/cpp/bindings/lib/serialization.h" |
| 13 #include "mojo/public/cpp/bindings/message.h" | 14 #include "mojo/public/cpp/bindings/message.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 internal { | 18 namespace internal { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 void SendRunOrClosePipeMessage(MessageReceiver* receiver, | 21 void SendRunOrClosePipeMessage(MessageReceiver* receiver, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 // has encountered an error, which will be visible through other means. | 40 // has encountered an error, which will be visible through other means. |
| 40 ALLOW_UNUSED_LOCAL(ok); | 41 ALLOW_UNUSED_LOCAL(ok); |
| 41 } | 42 } |
| 42 | 43 |
| 43 } // namespace | 44 } // namespace |
| 44 | 45 |
| 45 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver) | 46 PipeControlMessageProxy::PipeControlMessageProxy(MessageReceiver* receiver) |
| 46 : receiver_(receiver) {} | 47 : receiver_(receiver) {} |
| 47 | 48 |
| 48 void PipeControlMessageProxy::NotifyPeerEndpointClosed(InterfaceId id) { | 49 void PipeControlMessageProxy::NotifyPeerEndpointClosed(InterfaceId id) { |
| 50 DCHECK(!IsMasterInterfaceId(id)); |
| 49 pipe_control::PeerAssociatedEndpointClosedEventPtr event( | 51 pipe_control::PeerAssociatedEndpointClosedEventPtr event( |
| 50 pipe_control::PeerAssociatedEndpointClosedEvent::New()); | 52 pipe_control::PeerAssociatedEndpointClosedEvent::New()); |
| 51 event->id = id; | 53 event->id = id; |
| 52 | 54 |
| 53 pipe_control::RunOrClosePipeInputPtr input( | 55 pipe_control::RunOrClosePipeInputPtr input( |
| 54 pipe_control::RunOrClosePipeInput::New()); | 56 pipe_control::RunOrClosePipeInput::New()); |
| 55 input->set_peer_associated_endpoint_closed_event(std::move(event)); | 57 input->set_peer_associated_endpoint_closed_event(std::move(event)); |
| 56 | 58 |
| 57 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); | 59 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void PipeControlMessageProxy::NotifyEndpointClosedBeforeSent(InterfaceId id) { | 62 void PipeControlMessageProxy::NotifyEndpointClosedBeforeSent(InterfaceId id) { |
| 63 DCHECK(!IsMasterInterfaceId(id)); |
| 61 pipe_control::AssociatedEndpointClosedBeforeSentEventPtr event( | 64 pipe_control::AssociatedEndpointClosedBeforeSentEventPtr event( |
| 62 pipe_control::AssociatedEndpointClosedBeforeSentEvent::New()); | 65 pipe_control::AssociatedEndpointClosedBeforeSentEvent::New()); |
| 63 event->id = id; | 66 event->id = id; |
| 64 | 67 |
| 65 pipe_control::RunOrClosePipeInputPtr input( | 68 pipe_control::RunOrClosePipeInputPtr input( |
| 66 pipe_control::RunOrClosePipeInput::New()); | 69 pipe_control::RunOrClosePipeInput::New()); |
| 67 input->set_associated_endpoint_closed_before_sent_event(std::move(event)); | 70 input->set_associated_endpoint_closed_before_sent_event(std::move(event)); |
| 68 | 71 |
| 69 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); | 72 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); |
| 70 } | 73 } |
| 71 | 74 |
| 72 } // namespace internal | 75 } // namespace internal |
| 73 } // namespace mojo | 76 } // namespace mojo |
| OLD | NEW |