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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 NULLABLE_HANDLE, | 128 NULLABLE_HANDLE, |
129 NULLABLE_DCPIPE, | 129 NULLABLE_DCPIPE, |
130 NULLABLE_DPPIPE, | 130 NULLABLE_DPPIPE, |
131 NULLABLE_MSGPIPE, | 131 NULLABLE_MSGPIPE, |
132 NULLABLE_SHAREDBUFFER | 132 NULLABLE_SHAREDBUFFER |
133 ) | 133 ) |
134 | 134 |
135 | 135 |
136 ATTRIBUTE_MIN_VERSION = 'MinVersion' | 136 ATTRIBUTE_MIN_VERSION = 'MinVersion' |
137 ATTRIBUTE_EXTENSIBLE = 'Extensible' | 137 ATTRIBUTE_EXTENSIBLE = 'Extensible' |
| 138 ATTRIBUTE_SYNC = 'Sync' |
138 | 139 |
139 | 140 |
140 class NamedValue(object): | 141 class NamedValue(object): |
141 def __init__(self, module, parent_kind, name): | 142 def __init__(self, module, parent_kind, name): |
142 self.module = module | 143 self.module = module |
143 self.namespace = module.namespace | 144 self.namespace = module.namespace |
144 self.parent_kind = parent_kind | 145 self.parent_kind = parent_kind |
145 self.name = name | 146 self.name = name |
146 self.imported_from = None | 147 self.imported_from = None |
147 | 148 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 self.response_parameters = [] | 370 self.response_parameters = [] |
370 parameter = Parameter(name, kind, ordinal, default, attributes) | 371 parameter = Parameter(name, kind, ordinal, default, attributes) |
371 self.response_parameters.append(parameter) | 372 self.response_parameters.append(parameter) |
372 return parameter | 373 return parameter |
373 | 374 |
374 @property | 375 @property |
375 def min_version(self): | 376 def min_version(self): |
376 return self.attributes.get(ATTRIBUTE_MIN_VERSION) \ | 377 return self.attributes.get(ATTRIBUTE_MIN_VERSION) \ |
377 if self.attributes else None | 378 if self.attributes else None |
378 | 379 |
| 380 @property |
| 381 def sync(self): |
| 382 return self.attributes.get(ATTRIBUTE_SYNC) \ |
| 383 if self.attributes else None |
| 384 |
379 | 385 |
380 class Interface(ReferenceKind): | 386 class Interface(ReferenceKind): |
381 ReferenceKind.AddSharedProperty('module') | 387 ReferenceKind.AddSharedProperty('module') |
382 ReferenceKind.AddSharedProperty('name') | 388 ReferenceKind.AddSharedProperty('name') |
383 ReferenceKind.AddSharedProperty('imported_from') | 389 ReferenceKind.AddSharedProperty('imported_from') |
384 ReferenceKind.AddSharedProperty('methods') | 390 ReferenceKind.AddSharedProperty('methods') |
385 ReferenceKind.AddSharedProperty('attributes') | 391 ReferenceKind.AddSharedProperty('attributes') |
386 | 392 |
387 def __init__(self, name=None, module=None, attributes=None): | 393 def __init__(self, name=None, module=None, attributes=None): |
388 if name is not None: | 394 if name is not None: |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 visited_kinds = set() | 664 visited_kinds = set() |
659 for method in interface.methods: | 665 for method in interface.methods: |
660 for param in method.parameters: | 666 for param in method.parameters: |
661 if _ContainsAssociatedKinds(param.kind, visited_kinds): | 667 if _ContainsAssociatedKinds(param.kind, visited_kinds): |
662 return True | 668 return True |
663 if method.response_parameters != None: | 669 if method.response_parameters != None: |
664 for param in method.response_parameters: | 670 for param in method.response_parameters: |
665 if _ContainsAssociatedKinds(param.kind, visited_kinds): | 671 if _ContainsAssociatedKinds(param.kind, visited_kinds): |
666 return True | 672 return True |
667 return False | 673 return False |
OLD | NEW |