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

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

Issue 2112093002: Mojo C++ bindings: Merge EncodePointers/DecodePointers into Serialize/Deserialize, respectively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61_array_fix
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
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/validation_macros.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 cd37489a45555a759b220b39b6b0ff4323955da6..85d4a1da6cfda02af36c5c167d5abf41f297f05a 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -142,32 +142,6 @@ def IsNativeOnlyKind(kind):
def GetNativeTypeName(typemapped_kind):
return _current_typemap[GetFullMojomNameForKind(typemapped_kind)]["typename"]
-def GetCppType(kind):
- if mojom.IsArrayKind(kind):
- return "mojo::internal::Array_Data<%s>*" % GetCppType(kind.kind)
- if mojom.IsMapKind(kind):
- return "mojo::internal::Map_Data<%s, %s>*" % (
- GetCppType(kind.key_kind), GetCppType(kind.value_kind))
- if mojom.IsStructKind(kind):
- return "%s*" % GetNameForKind(kind, internal=True)
- if mojom.IsUnionKind(kind):
- return "%s" % GetNameForKind(kind, internal=True)
- if mojom.IsInterfaceKind(kind):
- return "mojo::internal::Interface_Data"
- if mojom.IsInterfaceRequestKind(kind):
- return "mojo::internal::Handle_Data"
- if mojom.IsAssociatedInterfaceKind(kind):
- return "mojo::internal::AssociatedInterface_Data"
- if mojom.IsAssociatedInterfaceRequestKind(kind):
- return "mojo::internal::AssociatedInterfaceRequest_Data"
- if mojom.IsEnumKind(kind):
- return "int32_t"
- if mojom.IsStringKind(kind):
- return "mojo::internal::String_Data*"
- if mojom.IsAnyHandleKind(kind):
- return "mojo::internal::Handle_Data"
- return _kind_to_cpp_type[kind]
-
def GetCppPodType(kind):
if mojom.IsStringKind(kind):
return "char*"
@@ -231,10 +205,10 @@ def GetCppFieldType(kind):
return "%s" % GetNameForKind(kind, internal=True)
if mojom.IsArrayKind(kind):
return ("mojo::internal::Pointer<mojo::internal::Array_Data<%s>>" %
- GetCppType(kind.kind))
+ GetCppFieldType(kind.kind))
if mojom.IsMapKind(kind):
return ("mojo::internal::Pointer<mojo::internal::Map_Data<%s, %s>>" %
- (GetCppType(kind.key_kind), GetCppType(kind.value_kind)))
+ (GetCppFieldType(kind.key_kind), GetCppFieldType(kind.value_kind)))
if mojom.IsInterfaceKind(kind):
return "mojo::internal::Interface_Data"
if mojom.IsInterfaceRequestKind(kind):
@@ -261,8 +235,6 @@ def GetUnionGetterReturnType(kind):
return "%s&" % GetCppWrapperType(kind)
return GetCppWrapperType(kind)
-# TODO(yzshen): It is unfortunate that we have so many functions for returning
-# types. Refactor them.
def GetUnmappedTypeForSerializer(kind):
if mojom.IsEnumKind(kind):
return GetQualifiedNameForKind(kind)
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/validation_macros.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698