Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: mojo/public/cpp/bindings/lib/control_message_handler.cc

Issue 2318793002: Mojo C++ bindings: support disconnect with a reason. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 interface_control::internal::RunOrClosePipeMessageParams_Data* params = 134 interface_control::internal::RunOrClosePipeMessageParams_Data* params =
135 reinterpret_cast< 135 reinterpret_cast<
136 interface_control::internal::RunOrClosePipeMessageParams_Data*>( 136 interface_control::internal::RunOrClosePipeMessageParams_Data*>(
137 message->mutable_payload()); 137 message->mutable_payload());
138 interface_control::RunOrClosePipeMessageParamsPtr params_ptr; 138 interface_control::RunOrClosePipeMessageParamsPtr params_ptr;
139 Deserialize<interface_control::RunOrClosePipeMessageParamsDataView>( 139 Deserialize<interface_control::RunOrClosePipeMessageParamsDataView>(
140 params, &params_ptr, &context_); 140 params, &params_ptr, &context_);
141 auto& input = *params_ptr->input; 141 auto& input = *params_ptr->input;
142 if (input.is_require_version()) 142 if (input.is_require_version())
143 return interface_version_ >= input.get_require_version()->version; 143 return interface_version_ >= input.get_require_version()->version;
144 else if (input.is_send_disconnect_reason()) {
145 disconnect_custom_reason_ =
146 input.get_send_disconnect_reason()->custom_reason;
147 disconnect_description_ =
148 std::move(input.get_send_disconnect_reason()->description);
149 return true;
150 }
144 151
145 return false; 152 return false;
146 } 153 }
147 154
148 } // namespace internal 155 } // namespace internal
149 } // namespace mojo 156 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/control_message_handler.h ('k') | mojo/public/cpp/bindings/lib/control_message_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698