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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 def AddStruct(self, name): | 327 def AddStruct(self, name): |
328 struct=Struct(name, module=self) | 328 struct=Struct(name, module=self) |
329 self.structs.append(struct) | 329 self.structs.append(struct) |
330 return struct | 330 return struct |
331 | 331 |
332 | 332 |
333 def IsBoolKind(kind): | 333 def IsBoolKind(kind): |
334 return kind.spec == BOOL.spec | 334 return kind.spec == BOOL.spec |
335 | 335 |
336 | 336 |
337 def IsFloatKind(kind): | |
338 return kind is not None and kind.spec == FLOAT.spec | |
yzshen1
2014/09/24 22:49:25
nit: All surrounding functions don't test kind is
hansmuller
2014/09/24 23:33:11
I've moved to the "is not None" test to the call s
| |
339 | |
340 | |
337 def IsStringKind(kind): | 341 def IsStringKind(kind): |
338 return kind.spec == STRING.spec or kind.spec == NULLABLE_STRING.spec | 342 return kind.spec == STRING.spec or kind.spec == NULLABLE_STRING.spec |
339 | 343 |
340 | 344 |
341 def IsHandleKind(kind): | 345 def IsHandleKind(kind): |
342 return kind.spec == HANDLE.spec or kind.spec == NULLABLE_HANDLE.spec | 346 return kind.spec == HANDLE.spec or kind.spec == NULLABLE_HANDLE.spec |
343 | 347 |
344 | 348 |
345 def IsDataPipeConsumerKind(kind): | 349 def IsDataPipeConsumerKind(kind): |
346 return kind.spec == DCPIPE.spec or kind.spec == NULLABLE_DCPIPE.spec | 350 return kind.spec == DCPIPE.spec or kind.spec == NULLABLE_DCPIPE.spec |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 def IsMoveOnlyKind(kind): | 420 def IsMoveOnlyKind(kind): |
417 return IsObjectKind(kind) or IsAnyHandleKind(kind) | 421 return IsObjectKind(kind) or IsAnyHandleKind(kind) |
418 | 422 |
419 | 423 |
420 def HasCallbacks(interface): | 424 def HasCallbacks(interface): |
421 for method in interface.methods: | 425 for method in interface.methods: |
422 if method.response_parameters != None: | 426 if method.response_parameters != None: |
423 return True | 427 return True |
424 return False | 428 return False |
425 | 429 |
OLD | NEW |