Index: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
index 29c99d567255a430ae278cde575af51bd4196a84..80ecdbae9e3161e33fb7695cd52c5ba3a3b97d54 100644 |
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl |
@@ -56,6 +56,26 @@ |
#include "{{header}}" |
{%- endfor %} |
+{#--- Struct Serialization Helpers -#} |
+{% for struct in structs %} |
+{%- if struct|is_native_only_kind and struct|is_typemapped_kind %} |
+{# This helps the array serializer understand how to serialize arrays of this |
+ native-only type. #} |
+ |
+namespace mojo { |
+namespace internal { |
+ |
+template <> |
+struct GetDataTypeAsArrayElement<{{struct|cpp_wrapper_type}}> { |
+ using Data = NativeStruct_Data*; |
+}; |
+ |
+} // namespace internal |
+} // namespace mojo |
+ |
+{%- endif %} |
+{%- endfor %} |
+ |
{%- for namespace in namespaces_as_array %} |
namespace {{namespace}} { |
{%- endfor %} |
@@ -172,46 +192,6 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr; |
{% endif %} |
{%- endfor %} |
-{#--- Struct Serialization Helpers -#} |
-{% for struct in structs %} |
-{%- if struct|is_native_only_kind and struct|is_typemapped_kind %} |
-{# This helps the array serializer understand how to serialize arrays of this |
- native-only type. |
- TODO(yzshen): Remove these specializations once the array serializtion code |
- is refactored to be specialized with Mojom stanadard type and user type. #} |
- |
-{%- if variant %} |
-} // namespace {{variant}} |
-{%- endif %} |
-{%- for namespace in namespaces_as_array|reverse %} |
-} // namespace {{namespace}} |
-{%- endfor %} |
- |
-namespace mojo { |
-namespace internal { |
- |
-template <> |
-struct ShouldUseNativeSerializer<{{struct|cpp_wrapper_type}}> { |
- static const bool value = true; |
-}; |
- |
-template <> |
-struct GetDataTypeAsArrayElement<{{struct|cpp_wrapper_type}}> { |
- using Data = NativeStruct_Data*; |
-}; |
- |
-} // namespace internal |
-} // namespace mojo |
- |
-{%- for namespace in namespaces_as_array %} |
-namespace {{namespace}} { |
-{%- endfor %} |
-{%- if variant %} |
-namespace {{variant}} { |
-{%- endif %} |
-{%- endif %} |
-{%- endfor %} |
- |
{#--- Union Serialization Helpers -#} |
{% if unions %} |
{% for union in unions %} |