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

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: 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
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 8f9c4d5365547cb027c6b1c338f34f8683e70e27..a2ccc554d23fad58c6f00a608cc07fd55d0dca60 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):

Powered by Google App Engine
This is Rietveld 408576698