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

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

Issue 1526533002: [mojo] Add pickling support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-4-bool-deserialize
Patch Set: merge Created 5 years 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, serialization_context) %} 9 {%- macro alloc_params(struct, serialization_context) %}
10 bool success = true; 10 bool success = true;
11 {%- for param in struct.packed.packed_fields_in_ordinal_order %} 11 {%- for param in struct.packed.packed_fields_in_ordinal_order %}
12 {{param.field.kind|cpp_result_type}} p_{{param.field.name}}{}; 12 {{param.field.kind|cpp_wrapper_type}} p_{{param.field.name}}{};
13 {%- endfor %} 13 {%- endfor %}
14 {{struct_macros.deserialize(struct, "params", "p_%s", serialization_context, " success")}} 14 {{struct_macros.deserialize(struct, "params", "p_%s", serialization_context, " success")}}
15 if (!success) 15 if (!success)
16 return false; 16 return false;
17 {%- endmacro %} 17 {%- endmacro %}
18 18
19 {%- macro pass_params(parameters) %} 19 {%- macro pass_params(parameters) %}
20 {%- for param in parameters %} 20 {%- for param in parameters %}
21 {%- if param.kind|is_move_only_kind -%} 21 {%- if param.kind|is_move_only_kind -%}
22 std::move(p_{{param.name}}) 22 std::move(p_{{param.name}})
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 default: 320 default:
321 break; 321 break;
322 } 322 }
323 323
324 // Unrecognized message. 324 // Unrecognized message.
325 ReportValidationError( 325 ReportValidationError(
326 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); 326 mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD);
327 return false; 327 return false;
328 } 328 }
329 {%- endif -%} 329 {%- endif -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698