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

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

Issue 2199043002: Mojo C++ bindings: inline struct data view field getters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@84_counter
Patch Set: . Created 4 years, 4 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/struct_data_view_definition.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 c6b0ade9e1df98aae20f963114dcc6b71f74a9bc..504283b721c6a14323140cf895f4dc1c9ed6f9c9 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -368,6 +368,12 @@ def TranslateConstants(token, kind):
def ExpressionToText(value, kind=None):
return TranslateConstants(value, kind)
+def RequiresContextForDataView(struct):
+ for field in struct.fields:
+ if mojom.IsReferenceKind(field.kind):
+ return True
+ return False
+
def ShouldInlineStruct(struct):
# TODO(darin): Base this on the size of the wrapper class.
if len(struct.fields) > 4:
@@ -446,6 +452,7 @@ class Generator(generator.Generator):
"get_qualified_name_for_kind": GetQualifiedNameForKind,
"has_callbacks": mojom.HasCallbacks,
"has_sync_methods": mojom.HasSyncMethods,
+ "requires_context_for_data_view": RequiresContextForDataView,
"should_inline": ShouldInlineStruct,
"should_inline_union": ShouldInlineUnion,
"is_array_kind": mojom.IsArrayKind,
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_data_view_definition.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698