| 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_handler.h" | 5 #include "mojo/public/cpp/bindings/lib/control_message_handler.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 bool ControlMessageHandler::Run(Message* message, | 50 bool ControlMessageHandler::Run(Message* message, |
| 51 MessageReceiverWithStatus* responder) { | 51 MessageReceiverWithStatus* responder) { |
| 52 RunResponseMessageParamsPtr response_params_ptr( | 52 RunResponseMessageParamsPtr response_params_ptr( |
| 53 RunResponseMessageParams::New()); | 53 RunResponseMessageParams::New()); |
| 54 response_params_ptr->reserved0 = 16u; | 54 response_params_ptr->reserved0 = 16u; |
| 55 response_params_ptr->reserved1 = 0u; | 55 response_params_ptr->reserved1 = 0u; |
| 56 response_params_ptr->query_version_result = QueryVersionResult::New(); | 56 response_params_ptr->query_version_result = QueryVersionResult::New(); |
| 57 response_params_ptr->query_version_result->version = interface_version_; | 57 response_params_ptr->query_version_result->version = interface_version_; |
| 58 | 58 |
| 59 size_t size = PrepareToSerialize<RunResponseMessageParamsPtr>( | 59 size_t size = PrepareToSerialize<RunResponseMessageParamsDataView>( |
| 60 response_params_ptr, &context_); | 60 response_params_ptr, &context_); |
| 61 ResponseMessageBuilder builder(kRunMessageId, size, message->request_id()); | 61 ResponseMessageBuilder builder(kRunMessageId, size, message->request_id()); |
| 62 | 62 |
| 63 RunResponseMessageParams_Data* response_params = nullptr; | 63 RunResponseMessageParams_Data* response_params = nullptr; |
| 64 Serialize<RunResponseMessageParamsPtr>(response_params_ptr, builder.buffer(), | 64 Serialize<RunResponseMessageParamsDataView>( |
| 65 &response_params, &context_); | 65 response_params_ptr, builder.buffer(), &response_params, &context_); |
| 66 bool ok = responder->Accept(builder.message()); | 66 bool ok = responder->Accept(builder.message()); |
| 67 ALLOW_UNUSED_LOCAL(ok); | 67 ALLOW_UNUSED_LOCAL(ok); |
| 68 delete responder; | 68 delete responder; |
| 69 | 69 |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool ControlMessageHandler::RunOrClosePipe(Message* message) { | 73 bool ControlMessageHandler::RunOrClosePipe(Message* message) { |
| 74 RunOrClosePipeMessageParams_Data* params = | 74 RunOrClosePipeMessageParams_Data* params = |
| 75 reinterpret_cast<RunOrClosePipeMessageParams_Data*>( | 75 reinterpret_cast<RunOrClosePipeMessageParams_Data*>( |
| 76 message->mutable_payload()); | 76 message->mutable_payload()); |
| 77 RunOrClosePipeMessageParamsPtr params_ptr; | 77 RunOrClosePipeMessageParamsPtr params_ptr; |
| 78 Deserialize<RunOrClosePipeMessageParamsPtr>(params, ¶ms_ptr, &context_); | 78 Deserialize<RunOrClosePipeMessageParamsDataView>(params, ¶ms_ptr, |
| 79 &context_); |
| 79 | 80 |
| 80 return interface_version_ >= params_ptr->require_version->version; | 81 return interface_version_ >= params_ptr->require_version->version; |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace internal | 84 } // namespace internal |
| 84 } // namespace mojo | 85 } // namespace mojo |
| OLD | NEW |