| OLD | NEW |
| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 NULLABLE_STRING, | 124 NULLABLE_STRING, |
| 125 NULLABLE_HANDLE, | 125 NULLABLE_HANDLE, |
| 126 NULLABLE_DCPIPE, | 126 NULLABLE_DCPIPE, |
| 127 NULLABLE_DPPIPE, | 127 NULLABLE_DPPIPE, |
| 128 NULLABLE_MSGPIPE, | 128 NULLABLE_MSGPIPE, |
| 129 NULLABLE_SHAREDBUFFER | 129 NULLABLE_SHAREDBUFFER |
| 130 ) | 130 ) |
| 131 | 131 |
| 132 | 132 |
| 133 ATTRIBUTE_MIN_VERSION = 'MinVersion' | 133 ATTRIBUTE_MIN_VERSION = 'MinVersion' |
| 134 ATTRIBUTE_EXTENSIBLE = 'Extensible' |
| 134 | 135 |
| 135 | 136 |
| 136 class NamedValue(object): | 137 class NamedValue(object): |
| 137 def __init__(self, module, parent_kind, name): | 138 def __init__(self, module, parent_kind, name): |
| 138 self.module = module | 139 self.module = module |
| 139 self.namespace = module.namespace | 140 self.namespace = module.namespace |
| 140 self.parent_kind = parent_kind | 141 self.parent_kind = parent_kind |
| 141 self.name = name | 142 self.name = name |
| 142 self.imported_from = None | 143 self.imported_from = None |
| 143 | 144 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 self.name = name | 439 self.name = name |
| 439 self.imported_from = None | 440 self.imported_from = None |
| 440 if name is not None: | 441 if name is not None: |
| 441 spec = 'x:' + name | 442 spec = 'x:' + name |
| 442 else: | 443 else: |
| 443 spec = None | 444 spec = None |
| 444 Kind.__init__(self, spec) | 445 Kind.__init__(self, spec) |
| 445 self.fields = [] | 446 self.fields = [] |
| 446 self.attributes = attributes | 447 self.attributes = attributes |
| 447 | 448 |
| 449 @property |
| 450 def extensible(self): |
| 451 return self.attributes.get(ATTRIBUTE_EXTENSIBLE, False) \ |
| 452 if self.attributes else False |
| 453 |
| 448 | 454 |
| 449 class Module(object): | 455 class Module(object): |
| 450 def __init__(self, name=None, namespace=None, attributes=None): | 456 def __init__(self, name=None, namespace=None, attributes=None): |
| 451 self.name = name | 457 self.name = name |
| 452 self.path = name | 458 self.path = name |
| 453 self.namespace = namespace | 459 self.namespace = namespace |
| 454 self.structs = [] | 460 self.structs = [] |
| 455 self.unions = [] | 461 self.unions = [] |
| 456 self.interfaces = [] | 462 self.interfaces = [] |
| 457 self.kinds = {} | 463 self.kinds = {} |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 visited_kinds = set() | 655 visited_kinds = set() |
| 650 for method in interface.methods: | 656 for method in interface.methods: |
| 651 for param in method.parameters: | 657 for param in method.parameters: |
| 652 if _ContainsAssociatedKinds(param.kind, visited_kinds): | 658 if _ContainsAssociatedKinds(param.kind, visited_kinds): |
| 653 return True | 659 return True |
| 654 if method.response_parameters != None: | 660 if method.response_parameters != None: |
| 655 for param in method.response_parameters: | 661 for param in method.response_parameters: |
| 656 if _ContainsAssociatedKinds(param.kind, visited_kinds): | 662 if _ContainsAssociatedKinds(param.kind, visited_kinds): |
| 657 return True | 663 return True |
| 658 return False | 664 return False |
| OLD | NEW |