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

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

Issue 613053002: Mojo: NULL -> nullptr in mojo/public/cpp/bindings and also for the bindings generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/cpp_templates/struct_serialization_definition.tmpl ('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')
11 # interface = module.AddInterface('Bar') 11 # interface = module.AddInterface('Bar')
12 # method = interface.AddMethod('Tat', 0) 12 # method = interface.AddMethod('Tat', 0)
13 # method.AddParameter('baz', 0, mojom.INT32) 13 # method.AddParameter('baz', 0, mojom.INT32)
14 14
15 15
16 class Kind(object): 16 class Kind(object):
17 def __init__(self, spec=None): 17 def __init__(self, spec=None):
18 self.spec = spec 18 self.spec = spec
19 self.parent_kind = None 19 self.parent_kind = None
20 20
21 21
22 class ReferenceKind(Kind): 22 class ReferenceKind(Kind):
23 """ReferenceKind represents pointer types and handle types. 23 """ReferenceKind represents pointer types and handle types.
24 A type is nullable means that NULL (for pointer types) or invalid handle 24 A type is nullable if null (for pointer types) or invalid handle (for handle
25 (for handle types) is a legal value for the type. 25 types) is a legal value for the type.
26 """ 26 """
27 27
28 def __init__(self, spec=None, is_nullable=False): 28 def __init__(self, spec=None, is_nullable=False):
29 assert spec is None or is_nullable == spec.startswith('?') 29 assert spec is None or is_nullable == spec.startswith('?')
30 Kind.__init__(self, spec) 30 Kind.__init__(self, spec)
31 self.is_nullable = is_nullable 31 self.is_nullable = is_nullable
32 self.shared_definition = {} 32 self.shared_definition = {}
33 33
34 def MakeNullableKind(self): 34 def MakeNullableKind(self):
35 assert not self.is_nullable 35 assert not self.is_nullable
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 def IsMoveOnlyKind(kind): 420 def IsMoveOnlyKind(kind):
421 return IsObjectKind(kind) or IsAnyHandleKind(kind) 421 return IsObjectKind(kind) or IsAnyHandleKind(kind)
422 422
423 423
424 def HasCallbacks(interface): 424 def HasCallbacks(interface):
425 for method in interface.methods: 425 for method in interface.methods:
426 if method.response_parameters != None: 426 if method.response_parameters != None:
427 return True 427 return True
428 return False 428 return False
429 429
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_definition.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698