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

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

Issue 2715153004: Mojo: Support enums as map keys in WTF (Closed)
Patch Set: Qualify name of generated hash fn Created 3 years, 10 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 9306d2f816d01b260f5203732f517b3d5b06f799..b93507c2774273a5d2b951d4b99dd0aac4c44f5b 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -86,6 +86,33 @@ namespace {{variant}} {
#include "{{export_header}}"
{%- endif %}
+{#--- WTF enum hashing #}
+{%- from "enum_macros.tmpl" import enum_hash_blink%}
+{%- if for_blink %}
+{#- Top-level #}
+{%- for enum in enums %}
yzshen1 2017/02/28 18:48:34 you could use "all_enums" for all enums at top lev
tibell 2017/03/01 23:08:39 Done.
+{%- if not enum|is_native_only_kind %}
+{{enum_hash_blink(enum)}}
+{%- endif %}
+{%- endfor %}
+{#- Inside structs #}
+{%- for struct in structs %}
+{%- for enum in struct.enums %}
+{%- if not enum|is_native_only_kind %}
+{{enum_hash_blink(enum)}}
+{%- endif %}
+{%- endfor %}
+{%- endfor %}
+{#- Inside interfaces #}
+{%- for iface in interfaces %}
+{%- for enum in iface.enums %}
+{%- if not enum|is_native_only_kind %}
+{{enum_hash_blink(enum)}}
+{%- endif %}
+{%- endfor %}
+{%- endfor %}
+{%- endif %}
+
{{namespace_begin()}}
{#--- Enums #}

Powered by Google App Engine
This is Rietveld 408576698