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

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

Issue 2031823002: Mojo C++ bindings: more consistent Clone() and Equals(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/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 a600f531f70344e5bca4f48b787c4f12f63b0008..279f937bfb35c4777bc74330474aefa3d67f20f7 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -169,14 +169,8 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr;
{% include "interface_response_validator_declaration.tmpl" %}
{%- endfor %}
-{#--- Unions must be declared first because they can be members of structs #}
-{#--- Unions #}
-{% for union in unions %}
-{% include "wrapper_union_class_declaration.tmpl" %}
-{%- endfor %}
-
-{#--- NOTE: Non-inlined structs may have pointers to inlined structs, so we #}
-{#--- need to fully define inlined structs ahead of the others. #}
+{#--- NOTE: Unions and non-inlined structs may have pointers to inlined structs,
+ so we need to fully define inlined structs ahead of the others. #}
{#--- Inlined structs #}
{% for struct in structs %}
@@ -186,6 +180,13 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr;
{% endif %}
{%- endfor %}
+{#--- Unions must be declared before non-inlined structs because they can be
+ members of structs. #}
+{#--- Unions #}
+{% for union in unions %}
+{% include "wrapper_union_class_declaration.tmpl" %}
+{%- endfor %}
+
{#--- Non-inlined structs #}
{% for struct in structs %}
{% if not struct|should_inline and not struct|is_native_only_kind %}
@@ -194,7 +195,15 @@ typedef mojo::StructPtr<{{union.name}}> {{union.name}}Ptr;
{% endif %}
{%- endfor %}
+{%- for union in unions %}
+{% include "wrapper_union_class_template_definition.tmpl" %}
+{%- endfor %}
+
{%- for struct in structs %}
+{%- if not struct|is_native_only_kind %}
+{% include "wrapper_class_template_definition.tmpl" %}
+{%- endif %}
+
{%- for enum in struct.enums %}
{{enum_stream_operator(enum)}}
{{is_known_enum_value(enum)}}

Powered by Google App Engine
This is Rietveld 408576698