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

Unified Diff: mojo/public/tools/bindings/generators/mojom_cpp_generator.py

Issue 2034273002: Mojo C++ bindings: introduce mojo::WTFMap for blink bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed the code of adding enum key support to WTF::HashMap; which turned out to be non-trivial; wi… Created 4 years, 6 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
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/mojom_cpp_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index a5121986d86e75120e8ec21fe4cf63af7d98f85b..c8d4f5bb1df8b6ab59500bcc7deec8843049a5ea 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -183,8 +183,9 @@ def GetCppArrayArgWrapperType(kind):
pattern = "mojo::WTFArray<%s>" if _for_blink else "mojo::Array<%s>"
return pattern % GetCppArrayArgWrapperType(kind.kind)
if mojom.IsMapKind(kind):
- return "mojo::Map<%s, %s> " % (GetCppArrayArgWrapperType(kind.key_kind),
- GetCppArrayArgWrapperType(kind.value_kind))
+ pattern = "mojo::WTFMap<%s, %s>" if _for_blink else "mojo::Map<%s, %s>"
+ return pattern % (GetCppArrayArgWrapperType(kind.key_kind),
+ GetCppArrayArgWrapperType(kind.value_kind))
if mojom.IsInterfaceKind(kind):
raise Exception("Arrays of interfaces not yet supported!")
if mojom.IsInterfaceRequestKind(kind):
@@ -219,8 +220,9 @@ def GetCppWrapperType(kind):
pattern = "mojo::WTFArray<%s>" if _for_blink else "mojo::Array<%s>"
return pattern % GetCppArrayArgWrapperType(kind.kind)
if mojom.IsMapKind(kind):
- return "mojo::Map<%s, %s>" % (GetCppArrayArgWrapperType(kind.key_kind),
- GetCppArrayArgWrapperType(kind.value_kind))
+ pattern = "mojo::WTFMap<%s, %s>" if _for_blink else "mojo::Map<%s, %s>"
+ return pattern % (GetCppArrayArgWrapperType(kind.key_kind),
+ GetCppArrayArgWrapperType(kind.value_kind))
if mojom.IsInterfaceKind(kind):
return "%sPtr" % GetNameForKind(kind)
if mojom.IsInterfaceRequestKind(kind):
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698