OLD | NEW |
1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
3 | 3 |
4 library service_provider_mojom; | 4 library service_provider_mojom; |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
9 | 9 |
10 | 10 |
11 | 11 |
12 class _ServiceProviderConnectToServiceParams extends bindings.Struct { | 12 class _ServiceProviderConnectToServiceParams extends bindings.Struct { |
13 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
14 const bindings.StructDataHeader(24, 0) | 14 const bindings.StructDataHeader(24, 0) |
15 ]; | 15 ]; |
16 String interfaceName = null; | 16 String interfaceName = null; |
17 core.MojoMessagePipeEndpoint pipe = null; | 17 core.MojoMessagePipeEndpoint pipe = null; |
18 | 18 |
19 _ServiceProviderConnectToServiceParams() : super(kVersions.last.size); | 19 _ServiceProviderConnectToServiceParams() : super(kVersions.last.size); |
20 | 20 |
| 21 _ServiceProviderConnectToServiceParams.init( |
| 22 String this.interfaceName, |
| 23 core.MojoMessagePipeEndpoint this.pipe |
| 24 ) : super(kVersions.last.size); |
| 25 |
21 static _ServiceProviderConnectToServiceParams deserialize(bindings.Message mes
sage) { | 26 static _ServiceProviderConnectToServiceParams deserialize(bindings.Message mes
sage) { |
22 var decoder = new bindings.Decoder(message); | 27 var decoder = new bindings.Decoder(message); |
23 var result = decode(decoder); | 28 var result = decode(decoder); |
24 if (decoder.excessHandles != null) { | 29 if (decoder.excessHandles != null) { |
25 decoder.excessHandles.forEach((h) => h.close()); | 30 decoder.excessHandles.forEach((h) => h.close()); |
26 } | 31 } |
27 return result; | 32 return result; |
28 } | 33 } |
29 | 34 |
30 static _ServiceProviderConnectToServiceParams decode(bindings.Decoder decoder0
) { | 35 static _ServiceProviderConnectToServiceParams decode(bindings.Decoder decoder0
) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 93 |
89 Map toJson() { | 94 Map toJson() { |
90 throw new bindings.MojoCodecError( | 95 throw new bindings.MojoCodecError( |
91 'Object containing handles cannot be encoded to JSON.'); | 96 'Object containing handles cannot be encoded to JSON.'); |
92 } | 97 } |
93 } | 98 } |
94 | 99 |
95 const int _serviceProviderMethodConnectToServiceName = 0; | 100 const int _serviceProviderMethodConnectToServiceName = 0; |
96 | 101 |
97 class _ServiceProviderServiceDescription implements service_describer.ServiceDes
cription { | 102 class _ServiceProviderServiceDescription implements service_describer.ServiceDes
cription { |
98 dynamic getTopLevelInterface([Function responseFactory]) => | 103 void getTopLevelInterface(Function responder) { |
99 responseFactory(null); | 104 responder(null); |
| 105 } |
100 | 106 |
101 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 107 void getTypeDefinition(String typeKey, Function responder) { |
102 responseFactory(null); | 108 responder(null); |
| 109 } |
103 | 110 |
104 dynamic getAllTypeDefinitions([Function responseFactory]) => | 111 void getAllTypeDefinitions(Function responder) { |
105 responseFactory(null); | 112 responder(null); |
| 113 } |
106 } | 114 } |
107 | 115 |
108 abstract class ServiceProvider { | 116 abstract class ServiceProvider { |
109 static const String serviceName = null; | 117 static const String serviceName = null; |
110 | 118 |
111 static service_describer.ServiceDescription _cachedServiceDescription; | 119 static service_describer.ServiceDescription _cachedServiceDescription; |
112 static service_describer.ServiceDescription get serviceDescription { | 120 static service_describer.ServiceDescription get serviceDescription { |
113 if (_cachedServiceDescription == null) { | 121 if (_cachedServiceDescription == null) { |
114 _cachedServiceDescription = new _ServiceProviderServiceDescription(); | 122 _cachedServiceDescription = new _ServiceProviderServiceDescription(); |
115 } | 123 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 : super.fromHandle(handle, autoBegin: impl != null) { | 254 : super.fromHandle(handle, autoBegin: impl != null) { |
247 _impl = impl; | 255 _impl = impl; |
248 } | 256 } |
249 | 257 |
250 _ServiceProviderStubControl.unbound([this._impl]) : super.unbound(); | 258 _ServiceProviderStubControl.unbound([this._impl]) : super.unbound(); |
251 | 259 |
252 String get serviceName => ServiceProvider.serviceName; | 260 String get serviceName => ServiceProvider.serviceName; |
253 | 261 |
254 | 262 |
255 | 263 |
256 dynamic handleMessage(bindings.ServiceMessage message) { | 264 void handleMessage(bindings.ServiceMessage message) { |
257 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 265 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
258 return bindings.ControlMessageHandler.handleMessage(this, | 266 bindings.ControlMessageHandler.handleMessage( |
259 0, | 267 this, 0, message); |
260 message); | 268 return; |
261 } | 269 } |
262 if (_impl == null) { | 270 if (_impl == null) { |
263 throw new core.MojoApiError("$this has no implementation set"); | 271 throw new core.MojoApiError("$this has no implementation set"); |
264 } | 272 } |
265 switch (message.header.type) { | 273 switch (message.header.type) { |
266 case _serviceProviderMethodConnectToServiceName: | 274 case _serviceProviderMethodConnectToServiceName: |
267 var params = _ServiceProviderConnectToServiceParams.deserialize( | 275 var params = _ServiceProviderConnectToServiceParams.deserialize( |
268 message.payload); | 276 message.payload); |
269 _impl.connectToService_(params.interfaceName, params.pipe); | 277 _impl.connectToService_(params.interfaceName, params.pipe); |
270 break; | 278 break; |
271 default: | 279 default: |
272 throw new bindings.MojoCodecError("Unexpected message name"); | 280 throw new bindings.MojoCodecError("Unexpected message name"); |
273 break; | 281 break; |
274 } | 282 } |
275 return null; | |
276 } | 283 } |
277 | 284 |
278 ServiceProvider get impl => _impl; | 285 ServiceProvider get impl => _impl; |
279 set impl(ServiceProvider d) { | 286 set impl(ServiceProvider d) { |
280 if (d == null) { | 287 if (d == null) { |
281 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 288 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
282 } | 289 } |
283 if (isBound && (_impl == null)) { | 290 if (isBound && (_impl == null)) { |
284 beginHandlingEvents(); | 291 beginHandlingEvents(); |
285 } | 292 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 333 } |
327 | 334 |
328 | 335 |
329 void connectToService_(String interfaceName, core.MojoMessagePipeEndpoint pipe
) { | 336 void connectToService_(String interfaceName, core.MojoMessagePipeEndpoint pipe
) { |
330 return impl.connectToService_(interfaceName, pipe); | 337 return impl.connectToService_(interfaceName, pipe); |
331 } | 338 } |
332 } | 339 } |
333 | 340 |
334 | 341 |
335 | 342 |
OLD | NEW |