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

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

Issue 1526533002: [mojo] Add pickling support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindings-4-bool-deserialize
Patch Set: merge 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 def _IsCloneable(kind, visited_kinds): 596 def _IsCloneable(kind, visited_kinds):
597 if kind in visited_kinds: 597 if kind in visited_kinds:
598 # No need to examine the kind again. 598 # No need to examine the kind again.
599 return True 599 return True
600 visited_kinds.add(kind) 600 visited_kinds.add(kind)
601 if IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind): 601 if IsAnyHandleKind(kind) or IsInterfaceKind(kind) or IsAssociatedKind(kind):
602 return False 602 return False
603 if IsArrayKind(kind): 603 if IsArrayKind(kind):
604 return _IsCloneable(kind.kind, visited_kinds) 604 return _IsCloneable(kind.kind, visited_kinds)
605 if IsStructKind(kind) or IsUnionKind(kind): 605 if IsStructKind(kind) or IsUnionKind(kind):
606 if IsStructKind(kind) and kind.native_only:
607 return False
606 for field in kind.fields: 608 for field in kind.fields:
607 if not _IsCloneable(field.kind, visited_kinds): 609 if not _IsCloneable(field.kind, visited_kinds):
608 return False 610 return False
609 if IsMapKind(kind): 611 if IsMapKind(kind):
610 # No need to examine the key kind, only primitive kinds and non-nullable 612 # No need to examine the key kind, only primitive kinds and non-nullable
611 # string are allowed to be key kinds. 613 # string are allowed to be key kinds.
612 return _IsCloneable(kind.value_kind, visited_kinds) 614 return _IsCloneable(kind.value_kind, visited_kinds)
613 return True 615 return True
614 616
615 return _IsCloneable(kind, set()) 617 return _IsCloneable(kind, set())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 visited_kinds = set() 649 visited_kinds = set()
648 for method in interface.methods: 650 for method in interface.methods:
649 for param in method.parameters: 651 for param in method.parameters:
650 if _ContainsAssociatedKinds(param.kind, visited_kinds): 652 if _ContainsAssociatedKinds(param.kind, visited_kinds):
651 return True 653 return True
652 if method.response_parameters != None: 654 if method.response_parameters != None:
653 for param in method.response_parameters: 655 for param in method.response_parameters:
654 if _ContainsAssociatedKinds(param.kind, visited_kinds): 656 if _ContainsAssociatedKinds(param.kind, visited_kinds):
655 return True 657 return True
656 return False 658 return False
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | third_party/mojo/mojo_edk_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698