Index: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl |
index 16e601d28b1506ff5260b4b921600272b5942368..00390a8578b747d9fdf22063f3b0cd39a4c631e3 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl |
@@ -100,9 +100,11 @@ struct {{struct.name}}_SerializerTraits_ { |
break; |
{%- endif %} |
{%- if pf.field.kind|is_string_kind %} |
- size += mojo::internal::String_Data::Traits::GetStorageSize( |
- static_cast<uint32_t>(mojo::StructTraits<{{struct.name}}, NativeType> |
- ::{{pf.field.name}}(input).size())); |
+ size += mojo::internal::Align( |
+ mojo::internal::String_Data::Traits::GetStorageSize( |
+ static_cast<uint32_t>( |
+ mojo::StructTraits<{{struct.name}}, NativeType> |
+ ::{{pf.field.name}}(input).size()))); |
{%- elif pf.field.kind|is_object_kind %} |
NOTREACHED() << "Unsupported field type for StructTraits: " |
<< "{{pf.field.name}}"; |