Index: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
index b4abd686decf4d889ffbf2308a84016ffc88e987..1c4d9f71b890f167c95918582b6b721568c41a6a 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl |
@@ -52,6 +52,23 @@ class {{struct.name}} { |
T, {{struct.name}}>::value>::type* = nullptr> |
bool Equals(const T& other) const; |
+{%- set serialization_result_type = "mojo::WTFArray<uint8_t>" |
+ if for_blink else "mojo::Array<uint8_t>" %} |
+ |
+ template <typename UserType> |
+ static {{serialization_result_type}} Serialize(UserType* input) { |
+ return mojo::internal::StructSerializeImpl< |
+ {{struct.name}}Ptr, {{serialization_result_type}}>(input); |
+ } |
+ |
+ template <typename UserType> |
+ static bool Deserialize({{serialization_result_type}} input, |
+ UserType* output) { |
+ return mojo::internal::StructDeserializeImpl< |
+ {{struct.name}}Ptr, {{serialization_result_type}}>( |
+ std::move(input), output); |
+ } |
+ |
{#--- Struct members #} |
{% for field in struct.fields %} |
{%- set type = field.kind|cpp_wrapper_type %} |