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

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

Issue 2030873002: Mojo C++ bindings: rename ArrayValidateParams for clarity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-enums
Patch Set: Rebase Created 4 years, 6 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 {%- set mojom_type = union|get_qualified_name_for_kind %} 1 {%- set mojom_type = union|get_qualified_name_for_kind %}
2 {%- set data_type = union|get_qualified_name_for_kind(internal=True) %} 2 {%- set data_type = union|get_qualified_name_for_kind(internal=True) %}
3 3
4 namespace internal { 4 namespace internal {
5 5
6 // static 6 // static
7 size_t UnionSerializerImpl<{{mojom_type}}Ptr>::PrepareToSerialize( 7 size_t UnionSerializerImpl<{{mojom_type}}Ptr>::PrepareToSerialize(
8 {{mojom_type}}Ptr& input, 8 {{mojom_type}}Ptr& input,
9 bool inlined, 9 bool inlined,
10 SerializationContext* context) { 10 SerializationContext* context) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 switch (input->which()) { 54 switch (input->which()) {
55 {% for field in union.fields %} 55 {% for field in union.fields %}
56 case {{mojom_type}}::Tag::{{field.name|upper}}: { 56 case {{mojom_type}}::Tag::{{field.name|upper}}: {
57 {% if field.kind|is_object_kind %} 57 {% if field.kind|is_object_kind %}
58 {%- set serializer_type = field.kind|unmapped_type_for_serializer %} 58 {%- set serializer_type = field.kind|unmapped_type_for_serializer %}
59 {% if field.kind|is_union_kind %} 59 {% if field.kind|is_union_kind %}
60 mojo::internal::Serialize<{{serializer_type}}>( 60 mojo::internal::Serialize<{{serializer_type}}>(
61 *(input_acc.data()->{{field.name}}), buf, 61 *(input_acc.data()->{{field.name}}), buf,
62 &result->data.f_{{field.name}}.ptr, false, context); 62 &result->data.f_{{field.name}}.ptr, false, context);
63 {% elif field.kind|is_array_kind or field.kind|is_map_kind %} 63 {% elif field.kind|is_array_kind or field.kind|is_map_kind %}
64 const ArrayValidateParams {{field.name}}_validate_params( 64 const ContainerValidateParams {{field.name}}_validate_params(
65 {{field.kind|get_array_validate_params_ctor_args|indent(16)}}); 65 {{field.kind|get_container_validate_params_ctor_args|indent(16)}});
66 mojo::internal::Serialize<{{serializer_type}}>( 66 mojo::internal::Serialize<{{serializer_type}}>(
67 *(input_acc.data()->{{field.name}}), buf, 67 *(input_acc.data()->{{field.name}}), buf,
68 &result->data.f_{{field.name}}.ptr, &{{field.name}}_validate_params, 68 &result->data.f_{{field.name}}.ptr, &{{field.name}}_validate_params,
69 context); 69 context);
70 {% else %} 70 {% else %}
71 mojo::internal::Serialize<{{serializer_type}}>( 71 mojo::internal::Serialize<{{serializer_type}}>(
72 *(input_acc.data()->{{field.name}}), buf, 72 *(input_acc.data()->{{field.name}}), buf,
73 &result->data.f_{{field.name}}.ptr, context); 73 &result->data.f_{{field.name}}.ptr, context);
74 {%- endif %} 74 {%- endif %}
75 {% elif field.kind|is_any_handle_kind %} 75 {% elif field.kind|is_any_handle_kind %}
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 {%- endfor %} 145 {%- endfor %}
146 } 146 }
147 *output = std::move(result); 147 *output = std::move(result);
148 } else { 148 } else {
149 output->reset(); 149 output->reset();
150 } 150 }
151 return success; 151 return success;
152 } 152 }
153 153
154 } // namespace internal 154 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698