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

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl

Issue 2136733002: Mojo C++ bindings: add a new mode to generator to use native STL/WTF types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@67_new
Patch Set: . Created 4 years, 5 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 {%- import "interface_macros.tmpl" as interface_macros %} 1 {%- import "interface_macros.tmpl" as interface_macros %}
2 {%- import "struct_macros.tmpl" as struct_macros %} 2 {%- import "struct_macros.tmpl" as struct_macros %}
3 3
4 {%- set class_name = interface.name %} 4 {%- set class_name = interface.name %}
5 {%- set proxy_name = interface.name ~ "Proxy" %} 5 {%- set proxy_name = interface.name ~ "Proxy" %}
6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} 6 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %}
7 7
8 {%- macro alloc_params(struct, params, message, serialization_context, 8 {%- macro alloc_params(struct, params, message, serialization_context,
9 description) %} 9 description) %}
10 ({{serialization_context}})->handles.Swap(({{message}})->mutable_handles()); 10 ({{serialization_context}})->handles.Swap(({{message}})->mutable_handles());
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 "{{class_name}}::{{method.name}}() was never run."); 258 "{{class_name}}::{{method.name}}() was never run.");
259 } 259 }
260 #endif 260 #endif
261 // If the Callback was dropped then deleting the responder will close 261 // If the Callback was dropped then deleting the responder will close
262 // the pipe so the calling application knows to stop waiting for a reply. 262 // the pipe so the calling application knows to stop waiting for a reply.
263 delete responder_; 263 delete responder_;
264 } 264 }
265 265
266 void Run( 266 void Run(
267 {{interface_macros.declare_responder_params( 267 {{interface_macros.declare_responder_params(
268 "in_", method.response_parameters, for_blink)}}); 268 "in_", method.response_parameters, for_blink,
269 use_new_wrapper_types)}});
269 270
270 uint64_t request_id_; 271 uint64_t request_id_;
271 bool is_sync_; 272 bool is_sync_;
272 mojo::MessageReceiverWithStatus* responder_; 273 mojo::MessageReceiverWithStatus* responder_;
273 // TODO(yzshen): maybe I should use a ref to the original one? 274 // TODO(yzshen): maybe I should use a ref to the original one?
274 mojo::internal::SerializationContext serialization_context_; 275 mojo::internal::SerializationContext serialization_context_;
275 276
276 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder); 277 DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder);
277 }; 278 };
278 279
279 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( 280 void {{class_name}}_{{method.name}}_ProxyToResponder::Run(
280 {{interface_macros.declare_responder_params( 281 {{interface_macros.declare_responder_params(
281 "in_", method.response_parameters, for_blink)}}) { 282 "in_", method.response_parameters, for_blink,
283 use_new_wrapper_types)}}) {
282 {{struct_macros.get_serialized_size(response_params_struct, "in_%s", 284 {{struct_macros.get_serialized_size(response_params_struct, "in_%s",
283 "&serialization_context_")}} 285 "&serialization_context_")}}
284 mojo::internal::ResponseMessageBuilder builder( 286 mojo::internal::ResponseMessageBuilder builder(
285 {{message_name}}, size, request_id_, 287 {{message_name}}, size, request_id_,
286 is_sync_ ? mojo::Message::kFlagIsSync : 0); 288 is_sync_ ? mojo::Message::kFlagIsSync : 0);
287 {{build_message(response_params_struct, "in_%s", params_description, 289 {{build_message(response_params_struct, "in_%s", params_description,
288 "&serialization_context_")}} 290 "&serialization_context_")}}
289 bool ok = responder_->Accept(builder.message()); 291 bool ok = responder_->Accept(builder.message());
290 ALLOW_UNUSED_LOCAL(ok); 292 ALLOW_UNUSED_LOCAL(ok);
291 // TODO(darin): !ok returned here indicates a malformed message, and that may 293 // TODO(darin): !ok returned here indicates a malformed message, and that may
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 break; 464 break;
463 } 465 }
464 466
465 // Unrecognized message. 467 // Unrecognized message.
466 ReportValidationError( 468 ReportValidationError(
467 &validation_context, 469 &validation_context,
468 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); 470 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD);
469 return false; 471 return false;
470 } 472 }
471 {%- endif -%} 473 {%- endif -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698