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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This module's classes provide an interface to mojo modules. Modules are 5 # This module's classes provide an interface to mojo modules. Modules are
6 # collections of interfaces and structs to be used by mojo ipc clients and 6 # collections of interfaces and structs to be used by mojo ipc clients and
7 # servers. 7 # servers.
8 # 8 #
9 # A simple interface would be created this way: 9 # A simple interface would be created this way:
10 # module = mojom.generate.module.Module('Foo') 10 # module = mojom.generate.module.Module('Foo')
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 return True 611 return True
612 612
613 return _IsCloneable(kind, set()) 613 return _IsCloneable(kind, set())
614 614
615 615
616 def HasCallbacks(interface): 616 def HasCallbacks(interface):
617 for method in interface.methods: 617 for method in interface.methods:
618 if method.response_parameters != None: 618 if method.response_parameters != None:
619 return True 619 return True
620 return False 620 return False
621
622
623 # Finds out whether an interface passes associated interfaces and associated
624 # interface requests.
625 def PassesAssociatedKinds(interface):
626 def _ContainsAssociatedKinds(kind, visited_kinds):
627 if kind in visited_kinds:
628 # No need to examine the kind again.
629 return False
630 visited_kinds.add(kind)
631 if IsAssociatedKind(kind):
632 return True
633 if IsArrayKind(kind):
634 return _ContainsAssociatedKinds(kind.kind, visited_kinds)
635 if IsStructKind(kind) or IsUnionKind(kind):
636 for field in kind.fields:
637 if _ContainsAssociatedKinds(field.kind, visited_kinds):
638 return True
639 if IsMapKind(kind):
640 # No need to examine the key kind, only primitive kinds and non-nullable
641 # string are allowed to be key kinds.
642 return _ContainsAssociatedKinds(kind.value_kind, visited_kinds)
643 return False
644
645 visited_kinds = set()
646 for method in interface.methods:
647 for param in method.parameters:
648 if _ContainsAssociatedKinds(param.kind, visited_kinds):
649 return True
650 if method.response_parameters != None:
651 for param in method.response_parameters:
652 if _ContainsAssociatedKinds(param.kind, visited_kinds):
653 return True
654 return False
OLDNEW
« 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