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

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

Issue 272323003: Mojo: Implement support for |Foo&| mojom syntax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 class Array(Kind): 116 class Array(Kind):
117 def __init__(self, kind=None): 117 def __init__(self, kind=None):
118 self.kind = kind 118 self.kind = kind
119 if kind != None: 119 if kind != None:
120 Kind.__init__(self, 'a:' + kind.spec) 120 Kind.__init__(self, 'a:' + kind.spec)
121 else: 121 else:
122 Kind.__init__(self) 122 Kind.__init__(self)
123 123
124 124
125 class InterfaceRequest(Kind):
126 def __init__(self, kind=None):
127 self.kind = kind
128 if kind != None:
129 Kind.__init__(self, 'r:' + kind.spec)
130 else:
131 Kind.__init__(self)
132
133
125 class Parameter(object): 134 class Parameter(object):
126 def __init__(self, name=None, kind=None, ordinal=None, default=None): 135 def __init__(self, name=None, kind=None, ordinal=None, default=None):
127 self.name = name 136 self.name = name
128 self.ordinal = ordinal 137 self.ordinal = ordinal
129 self.kind = kind 138 self.kind = kind
130 self.default = default 139 self.default = default
131 140
132 141
133 class Method(object): 142 class Method(object):
134 def __init__(self, interface, name, ordinal=None): 143 def __init__(self, interface, name, ordinal=None):
(...skipping 13 matching lines...) Expand all
148 self.response_parameters = [] 157 self.response_parameters = []
149 parameter = Parameter(name, kind, ordinal, default) 158 parameter = Parameter(name, kind, ordinal, default)
150 self.response_parameters.append(parameter) 159 self.response_parameters.append(parameter)
151 return parameter 160 return parameter
152 161
153 162
154 class Interface(Kind): 163 class Interface(Kind):
155 def __init__(self, name=None, client=None, module=None): 164 def __init__(self, name=None, client=None, module=None):
156 self.module = module 165 self.module = module
157 self.name = name 166 self.name = name
167 self.imported_from = None
158 if name != None: 168 if name != None:
159 spec = 'x:' + name 169 spec = 'x:' + name
160 else: 170 else:
161 spec = None 171 spec = None
162 Kind.__init__(self, spec) 172 Kind.__init__(self, spec)
163 self.client = client 173 self.client = client
164 self.methods = [] 174 self.methods = []
165 175
166 def AddMethod(self, name, ordinal=None): 176 def AddMethod(self, name, ordinal=None):
167 method = Method(self, name, ordinal=ordinal) 177 method = Method(self, name, ordinal=ordinal)
(...skipping 30 matching lines...) Expand all
198 208
199 def AddInterface(self, name): 209 def AddInterface(self, name):
200 interface=Interface(name, module=self); 210 interface=Interface(name, module=self);
201 self.interfaces.append(interface) 211 self.interfaces.append(interface)
202 return interface 212 return interface
203 213
204 def AddStruct(self, name): 214 def AddStruct(self, name):
205 struct=Struct(name, module=self) 215 struct=Struct(name, module=self)
206 self.structs.append(struct) 216 self.structs.append(struct)
207 return struct 217 return struct
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/generator.py ('k') | mojo/public/tools/bindings/pylib/mojom/generate/pack.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698