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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl

Issue 1867483002: Mojo: Align string sizes when serializing a native type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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}}";
« mojo/public/tools/bindings/bindings.gyp ('K') | « mojo/public/tools/bindings/bindings.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698