| 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" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.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/cpp/bindings/message.h" | 14 #include "mojo/public/cpp/bindings/message.h" |
| 15 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h" | 15 #include "mojo/public/interfaces/bindings/pipe_control_messages.mojom.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 void SendRunOrClosePipeMessage(MessageReceiver* receiver, | 20 void SendRunOrClosePipeMessage(MessageReceiver* receiver, |
| 21 pipe_control::RunOrClosePipeInputPtr input, | 21 pipe_control::RunOrClosePipeInputPtr input, |
| 22 internal::SerializationContext* context) { | 22 internal::SerializationContext* context) { |
| 23 pipe_control::RunOrClosePipeMessageParamsPtr params_ptr( | 23 pipe_control::RunOrClosePipeMessageParamsPtr params_ptr( |
| 24 pipe_control::RunOrClosePipeMessageParams::New()); | 24 pipe_control::RunOrClosePipeMessageParams::New()); |
| 25 params_ptr->input = std::move(input); | 25 params_ptr->input = std::move(input); |
| 26 | 26 |
| 27 size_t size = | 27 size_t size = internal::PrepareToSerialize< |
| 28 internal::PrepareToSerialize< | 28 pipe_control::RunOrClosePipeMessageParamsDataView>(params_ptr, context); |
| 29 pipe_control::RunOrClosePipeMessageParamsPtr>(params_ptr, context); | |
| 30 internal::MessageBuilder builder(pipe_control::kRunOrClosePipeMessageId, | 29 internal::MessageBuilder builder(pipe_control::kRunOrClosePipeMessageId, |
| 31 size); | 30 size); |
| 32 | 31 |
| 33 pipe_control::internal::RunOrClosePipeMessageParams_Data* params = nullptr; | 32 pipe_control::internal::RunOrClosePipeMessageParams_Data* params = nullptr; |
| 34 internal::Serialize<pipe_control::RunOrClosePipeMessageParamsPtr>( | 33 internal::Serialize<pipe_control::RunOrClosePipeMessageParamsDataView>( |
| 35 params_ptr, builder.buffer(), ¶ms, context); | 34 params_ptr, builder.buffer(), ¶ms, context); |
| 36 builder.message()->set_interface_id(kInvalidInterfaceId); | 35 builder.message()->set_interface_id(kInvalidInterfaceId); |
| 37 bool ok = receiver->Accept(builder.message()); | 36 bool ok = receiver->Accept(builder.message()); |
| 38 // This return value may be ignored as !ok implies the underlying message pipe | 37 // This return value may be ignored as !ok implies the underlying message pipe |
| 39 // has encountered an error, which will be visible through other means. | 38 // has encountered an error, which will be visible through other means. |
| 40 ALLOW_UNUSED_LOCAL(ok); | 39 ALLOW_UNUSED_LOCAL(ok); |
| 41 } | 40 } |
| 42 | 41 |
| 43 } // namespace | 42 } // namespace |
| 44 | 43 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 event->id = id; | 64 event->id = id; |
| 66 | 65 |
| 67 pipe_control::RunOrClosePipeInputPtr input( | 66 pipe_control::RunOrClosePipeInputPtr input( |
| 68 pipe_control::RunOrClosePipeInput::New()); | 67 pipe_control::RunOrClosePipeInput::New()); |
| 69 input->set_associated_endpoint_closed_before_sent_event(std::move(event)); | 68 input->set_associated_endpoint_closed_before_sent_event(std::move(event)); |
| 70 | 69 |
| 71 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); | 70 SendRunOrClosePipeMessage(receiver_, std::move(input), &context_); |
| 72 } | 71 } |
| 73 | 72 |
| 74 } // namespace mojo | 73 } // namespace mojo |
| OLD | NEW |