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

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

Issue 1768373003: Treat typemapped kinds as un-cloneable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 def IsAssociatedKind(kind): 600 def IsAssociatedKind(kind):
601 return (IsAssociatedInterfaceKind(kind) or 601 return (IsAssociatedInterfaceKind(kind) or
602 IsAssociatedInterfaceRequestKind(kind)) 602 IsAssociatedInterfaceRequestKind(kind))
603 603
604 604
605 def IsMoveOnlyKind(kind): 605 def IsMoveOnlyKind(kind):
606 return (not IsStringKind(kind) and IsObjectKind(kind)) or \ 606 return (not IsStringKind(kind) and IsObjectKind(kind)) or \
607 IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind) 607 IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind)
608 608
609 609
610 def IsCloneableKind(kind): 610 def IsCloneableKind(kind, filter):
611 def _IsCloneable(kind, visited_kinds): 611 def _IsCloneable(kind, visited_kinds):
612 if kind in visited_kinds: 612 if kind in visited_kinds:
613 # No need to examine the kind again. 613 # No need to examine the kind again.
614 return True 614 return True
615 visited_kinds.add(kind) 615 visited_kinds.add(kind)
616 if IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind): 616 if IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind):
617 return False 617 return False
618 if IsArrayKind(kind): 618 if IsArrayKind(kind):
619 return _IsCloneable(kind.kind, visited_kinds) 619 return _IsCloneable(kind.kind, visited_kinds)
620 if IsStructKind(kind) or IsUnionKind(kind): 620 if IsStructKind(kind) or IsUnionKind(kind):
621 if IsStructKind(kind) and kind.native_only: 621 if IsStructKind(kind) and (kind.native_only or filter(kind)):
622 return False 622 return False
623 for field in kind.fields: 623 for field in kind.fields:
624 if not _IsCloneable(field.kind, visited_kinds): 624 if not _IsCloneable(field.kind, visited_kinds):
625 return False 625 return False
626 if IsMapKind(kind): 626 if IsMapKind(kind):
627 # No need to examine the key kind, only primitive kinds and non-nullable 627 # No need to examine the key kind, only primitive kinds and non-nullable
628 # string are allowed to be key kinds. 628 # string are allowed to be key kinds.
629 return _IsCloneable(kind.value_kind, visited_kinds) 629 return _IsCloneable(kind.value_kind, visited_kinds)
630 return True 630 return True
631 631
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 if _ContainsAssociatedKinds(param.kind, visited_kinds): 671 if _ContainsAssociatedKinds(param.kind, visited_kinds):
672 return True 672 return True
673 return False 673 return False
674 674
675 675
676 def HasSyncMethods(interface): 676 def HasSyncMethods(interface):
677 for method in interface.methods: 677 for method in interface.methods:
678 if method.sync: 678 if method.sync:
679 return True 679 return True
680 return False 680 return False
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698