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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 message->mutable_payload()); | 54 message->mutable_payload()); |
55 interface_control::RunMessageParamsPtr params_ptr; | 55 interface_control::RunMessageParamsPtr params_ptr; |
56 Deserialize<interface_control::RunMessageParamsDataView>(params, ¶ms_ptr, | 56 Deserialize<interface_control::RunMessageParamsDataView>(params, ¶ms_ptr, |
57 &context_); | 57 &context_); |
58 auto& input = *params_ptr->input; | 58 auto& input = *params_ptr->input; |
59 interface_control::RunOutputPtr output = interface_control::RunOutput::New(); | 59 interface_control::RunOutputPtr output = interface_control::RunOutput::New(); |
60 if (input.is_query_version()) { | 60 if (input.is_query_version()) { |
61 output->set_query_version_result( | 61 output->set_query_version_result( |
62 interface_control::QueryVersionResult::New()); | 62 interface_control::QueryVersionResult::New()); |
63 output->get_query_version_result()->version = interface_version_; | 63 output->get_query_version_result()->version = interface_version_; |
| 64 } else if (input.is_flush_for_testing()) { |
| 65 output.reset(); |
64 } else { | 66 } else { |
65 output.reset(); | 67 output.reset(); |
66 } | 68 } |
67 | 69 |
68 auto response_params_ptr = interface_control::RunResponseMessageParams::New(); | 70 auto response_params_ptr = interface_control::RunResponseMessageParams::New(); |
69 response_params_ptr->output = std::move(output); | 71 response_params_ptr->output = std::move(output); |
70 size_t size = | 72 size_t size = |
71 PrepareToSerialize<interface_control::RunResponseMessageParamsDataView>( | 73 PrepareToSerialize<interface_control::RunResponseMessageParamsDataView>( |
72 response_params_ptr, &context_); | 74 response_params_ptr, &context_); |
73 ResponseMessageBuilder builder(interface_control::kRunMessageId, size, | 75 ResponseMessageBuilder builder(interface_control::kRunMessageId, size, |
(...skipping 20 matching lines...) Expand all Loading... |
94 params, ¶ms_ptr, &context_); | 96 params, ¶ms_ptr, &context_); |
95 auto& input = *params_ptr->input; | 97 auto& input = *params_ptr->input; |
96 if (input.is_require_version()) | 98 if (input.is_require_version()) |
97 return interface_version_ >= input.get_require_version()->version; | 99 return interface_version_ >= input.get_require_version()->version; |
98 | 100 |
99 return false; | 101 return false; |
100 } | 102 } |
101 | 103 |
102 } // namespace internal | 104 } // namespace internal |
103 } // namespace mojo | 105 } // namespace mojo |
OLD | NEW |