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

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

Issue 1101303002: Update mojo sdk to rev e7270700d671fa8e458b4d8c9e47f7bcfb65da0b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actualy provide a default TaskTracker impl Created 5 years, 8 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: third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index 10ce58214599a330c56e6b52e35ea5fb18cb9331..b5bf6a460ee00c54a435f4840d94d0026dfb4611 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -227,6 +227,12 @@ def GetCppFieldType(kind):
return "mojo::internal::StringPointer"
return _kind_to_cpp_type[kind]
+def GetUnionGetterReturnType(kind):
+ if (mojom.IsStructKind(kind) or mojom.IsArrayKind(kind) or
+ mojom.IsMapKind(kind)):
+ return "%s&" % GetCppWrapperType(kind)
+ return GetCppResultWrapperType(kind)
+
def IsStructWithHandles(struct):
for pf in struct.packed.packed_fields:
if mojom.IsAnyHandleKind(pf.field.kind):
@@ -335,6 +341,7 @@ class Generator(generator.Generator):
"cpp_pod_type": GetCppPodType,
"cpp_result_type": GetCppResultWrapperType,
"cpp_type": GetCppType,
+ "cpp_union_getter_return_type": GetUnionGetterReturnType,
"cpp_wrapper_type": GetCppWrapperType,
"default_value": DefaultValue,
"expression_to_text": ExpressionToText,
@@ -374,7 +381,7 @@ class Generator(generator.Generator):
"kinds": self.module.kinds,
"enums": self.module.enums,
"structs": self.GetStructs(),
- "unions": self.module.unions,
+ "unions": self.GetUnions(),
"interfaces": self.GetInterfaces(),
}

Powered by Google App Engine
This is Rietveld 408576698