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

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

Issue 1358353002: * Change C++ serialization/deserialization to not be move-only operations (with the except of |Ha… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: (*it).get() to it->, and other formatting Created 5 years, 2 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 {%- from "enum_macros.tmpl" import is_valid_enum_def %} 3 {%- from "enum_macros.tmpl" import is_valid_enum_def %}
4 4
5 {%- set class_name = interface.name %} 5 {%- set class_name = interface.name %}
6 {%- set proxy_name = interface.name ~ "Proxy" %} 6 {%- set proxy_name = interface.name ~ "Proxy" %}
7 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %} 7 {%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %}
8 8
9 {%- macro alloc_params(struct) %} 9 {%- macro alloc_params(struct) %}
10 {%- for param in struct.packed.packed_fields_in_ordinal_order %} 10 {%- for param in struct.packed.packed_fields_in_ordinal_order %}
11 {{param.field.kind|cpp_result_type}} p_{{param.field.name}}{}; 11 {{param.field.kind|cpp_result_type}} p_{{param.field.name}} {};
12 {%- endfor %} 12 {%- endfor %}
13 {{struct_macros.deserialize(struct, "params", "p_%s")}} 13 {{struct_macros.deserialize(struct, "params", "p_%s")}}
14 {%- endmacro %} 14 {%- endmacro %}
15 15
16 {%- macro pass_params(parameters) %} 16 {%- macro pass_params(parameters) %}
17 {%- for param in parameters %} 17 {%- for param in parameters %}
18 {%- if param.kind|is_move_only_kind -%} 18 {%- if param.kind|is_move_only_kind -%}
19 p_{{param.name}}.Pass() 19 p_{{param.name}}.Pass()
20 {%- else -%} 20 {%- else -%}
21 p_{{param.name}} 21 p_{{param.name}}
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 default: 313 default:
314 break; 314 break;
315 } 315 }
316 316
317 // Unrecognized message. 317 // Unrecognized message.
318 ReportValidationError( 318 ReportValidationError(
319 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); 319 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD);
320 return false; 320 return false;
321 } 321 }
322 {%- endif -%} 322 {%- endif -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698