| 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/control_message_proxy.h" | 5 #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 auto params_ptr = interface_control::RunMessageParams::New(); | 78 auto params_ptr = interface_control::RunMessageParams::New(); |
| 79 params_ptr->input = std::move(input_ptr); | 79 params_ptr->input = std::move(input_ptr); |
| 80 size_t size = PrepareToSerialize<interface_control::RunMessageParamsDataView>( | 80 size_t size = PrepareToSerialize<interface_control::RunMessageParamsDataView>( |
| 81 params_ptr, &context); | 81 params_ptr, &context); |
| 82 MessageBuilder builder(interface_control::kRunMessageId, | 82 MessageBuilder builder(interface_control::kRunMessageId, |
| 83 Message::kFlagExpectsResponse, size, 0); | 83 Message::kFlagExpectsResponse, size, 0); |
| 84 | 84 |
| 85 interface_control::internal::RunMessageParams_Data* params = nullptr; | 85 interface_control::internal::RunMessageParams_Data* params = nullptr; |
| 86 Serialize<interface_control::RunMessageParamsDataView>( | 86 Serialize<interface_control::RunMessageParamsDataView>( |
| 87 params_ptr, builder.buffer(), ¶ms, &context); | 87 params_ptr, builder.buffer(), ¶ms, &context); |
| 88 MessageReceiver* responder = new RunResponseForwardToCallback(callback); | 88 std::unique_ptr<MessageReceiver> responder = |
| 89 if (!receiver->AcceptWithResponder(builder.message(), responder)) | 89 base::MakeUnique<RunResponseForwardToCallback>(callback); |
| 90 delete responder; | 90 ignore_result( |
| 91 receiver->AcceptWithResponder(builder.message(), std::move(responder))); |
| 91 } | 92 } |
| 92 | 93 |
| 93 Message ConstructRunOrClosePipeMessage( | 94 Message ConstructRunOrClosePipeMessage( |
| 94 interface_control::RunOrClosePipeInputPtr input_ptr) { | 95 interface_control::RunOrClosePipeInputPtr input_ptr) { |
| 95 SerializationContext context; | 96 SerializationContext context; |
| 96 | 97 |
| 97 auto params_ptr = interface_control::RunOrClosePipeMessageParams::New(); | 98 auto params_ptr = interface_control::RunOrClosePipeMessageParams::New(); |
| 98 params_ptr->input = std::move(input_ptr); | 99 params_ptr->input = std::move(input_ptr); |
| 99 | 100 |
| 100 size_t size = PrepareToSerialize< | 101 size_t size = PrepareToSerialize< |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 180 } |
| 180 | 181 |
| 181 void ControlMessageProxy::OnConnectionError() { | 182 void ControlMessageProxy::OnConnectionError() { |
| 182 encountered_error_ = true; | 183 encountered_error_ = true; |
| 183 if (!run_loop_quit_closure_.is_null()) | 184 if (!run_loop_quit_closure_.is_null()) |
| 184 RunFlushForTestingClosure(); | 185 RunFlushForTestingClosure(); |
| 185 } | 186 } |
| 186 | 187 |
| 187 } // namespace internal | 188 } // namespace internal |
| 188 } // namespace mojo | 189 } // namespace mojo |
| OLD | NEW |