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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/module.py

Issue 1473273003: Mojo C++ bindings: InterfacePtr<T> and Binding<T> use MultiplexRouter when T passes associated inte… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/mojom_cpp_generator.py ('k') | third_party/mojo/mojo_public.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/pylib/mojom/generate/module.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
index 37c76a2b8d0d5cd345418290218bc7e5959f2586..8af874fa71ed335be679939450a7535e22a72ee4 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -618,3 +618,37 @@ def HasCallbacks(interface):
if method.response_parameters != None:
return True
return False
+
+
+# Finds out whether an interface passes associated interfaces and associated
+# interface requests.
+def PassesAssociatedKinds(interface):
+ def _ContainsAssociatedKinds(kind, visited_kinds):
+ if kind in visited_kinds:
+ # No need to examine the kind again.
+ return False
+ visited_kinds.add(kind)
+ if IsAssociatedKind(kind):
+ return True
+ if IsArrayKind(kind):
+ return _ContainsAssociatedKinds(kind.kind, visited_kinds)
+ if IsStructKind(kind) or IsUnionKind(kind):
+ for field in kind.fields:
+ if _ContainsAssociatedKinds(field.kind, visited_kinds):
+ return True
+ if IsMapKind(kind):
+ # No need to examine the key kind, only primitive kinds and non-nullable
+ # string are allowed to be key kinds.
+ return _ContainsAssociatedKinds(kind.value_kind, visited_kinds)
+ return False
+
+ visited_kinds = set()
+ for method in interface.methods:
+ for param in method.parameters:
+ if _ContainsAssociatedKinds(param.kind, visited_kinds):
+ return True
+ if method.response_parameters != None:
+ for param in method.response_parameters:
+ if _ContainsAssociatedKinds(param.kind, visited_kinds):
+ return True
+ return False
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | third_party/mojo/mojo_public.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698