| Index: mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
|
| diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
|
| index 03911b9b39b47e10ae9386c56624cb41e2c08d09..c585bb7c5f79010317c81e588726df536c9ea211 100644
|
| --- a/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
|
| +++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_macros.tmpl
|
| @@ -46,12 +46,19 @@
|
| {%- elif kind|is_map_kind %}
|
| mojo::SerializeMap_<{{kind.value_kind|get_map_validate_params|indent(24)}}>(
|
| mojo::internal::Forward({{input_field}}), {{buffer}}, &{{output}}->{{name}}.ptr);
|
| +{%- elif kind|is_union_kind %}
|
| + internal::{{kind.name}}_Data* {{name}}_ptr = &{{output}}->{{name}};
|
| + SerializeUnion_(mojo::internal::Forward({{input_field}}), {{buffer}}, &{{name}}_ptr, true);
|
| {%- else %}
|
| Serialize_(mojo::internal::Forward({{input_field}}), {{buffer}}, &{{output}}->{{name}}.ptr);
|
| {%- endif %}
|
| {%- if not kind|is_nullable_kind %}
|
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
|
| +{%- if kind|is_union_kind %}
|
| + {{output}}->{{name}}.is_null(),
|
| +{%- else %}
|
| !{{output}}->{{name}}.ptr,
|
| +{%- endif %}
|
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
|
| "null {{name}} in {{struct_display_name}}");
|
| {%- endif %}
|
| @@ -103,7 +110,11 @@
|
| break;
|
| {%- endif %}
|
| {%- if kind|is_object_kind %}
|
| +{%- if kind|is_union_kind %}
|
| + Deserialize_(&{{input}}->{{name}}, &{{output_field}});
|
| +{%- else %}
|
| Deserialize_({{input}}->{{name}}.ptr, &{{output_field}});
|
| +{%- endif %}
|
| {%- elif kind|is_interface_kind or kind|is_interface_request_kind %}
|
| {{output_field}}.Bind(mojo::MakeScopedHandle(mojo::internal::FetchAndReset(&{{input}}->{{name}})));
|
| {%- elif kind|is_any_handle_kind %}
|
|
|