| 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 icu_data_mojom; | 4 library icu_data_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 _IcuDataMapParams extends bindings.Struct { | 12 class _IcuDataMapParams extends bindings.Struct { |
| 13 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
| 14 const bindings.StructDataHeader(16, 0) | 14 const bindings.StructDataHeader(16, 0) |
| 15 ]; | 15 ]; |
| 16 String sha1hash = null; | 16 String sha1hash = null; |
| 17 | 17 |
| 18 _IcuDataMapParams() : super(kVersions.last.size); | 18 _IcuDataMapParams() : super(kVersions.last.size); |
| 19 | 19 |
| 20 _IcuDataMapParams.init( |
| 21 String this.sha1hash |
| 22 ) : super(kVersions.last.size); |
| 23 |
| 20 static _IcuDataMapParams deserialize(bindings.Message message) { | 24 static _IcuDataMapParams deserialize(bindings.Message message) { |
| 21 var decoder = new bindings.Decoder(message); | 25 var decoder = new bindings.Decoder(message); |
| 22 var result = decode(decoder); | 26 var result = decode(decoder); |
| 23 if (decoder.excessHandles != null) { | 27 if (decoder.excessHandles != null) { |
| 24 decoder.excessHandles.forEach((h) => h.close()); | 28 decoder.excessHandles.forEach((h) => h.close()); |
| 25 } | 29 } |
| 26 return result; | 30 return result; |
| 27 } | 31 } |
| 28 | 32 |
| 29 static _IcuDataMapParams decode(bindings.Decoder decoder0) { | 33 static _IcuDataMapParams decode(bindings.Decoder decoder0) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 86 |
| 83 | 87 |
| 84 class IcuDataMapResponseParams extends bindings.Struct { | 88 class IcuDataMapResponseParams extends bindings.Struct { |
| 85 static const List<bindings.StructDataHeader> kVersions = const [ | 89 static const List<bindings.StructDataHeader> kVersions = const [ |
| 86 const bindings.StructDataHeader(16, 0) | 90 const bindings.StructDataHeader(16, 0) |
| 87 ]; | 91 ]; |
| 88 core.MojoSharedBuffer icuData = null; | 92 core.MojoSharedBuffer icuData = null; |
| 89 | 93 |
| 90 IcuDataMapResponseParams() : super(kVersions.last.size); | 94 IcuDataMapResponseParams() : super(kVersions.last.size); |
| 91 | 95 |
| 96 IcuDataMapResponseParams.init( |
| 97 core.MojoSharedBuffer this.icuData |
| 98 ) : super(kVersions.last.size); |
| 99 |
| 92 static IcuDataMapResponseParams deserialize(bindings.Message message) { | 100 static IcuDataMapResponseParams deserialize(bindings.Message message) { |
| 93 var decoder = new bindings.Decoder(message); | 101 var decoder = new bindings.Decoder(message); |
| 94 var result = decode(decoder); | 102 var result = decode(decoder); |
| 95 if (decoder.excessHandles != null) { | 103 if (decoder.excessHandles != null) { |
| 96 decoder.excessHandles.forEach((h) => h.close()); | 104 decoder.excessHandles.forEach((h) => h.close()); |
| 97 } | 105 } |
| 98 return result; | 106 return result; |
| 99 } | 107 } |
| 100 | 108 |
| 101 static IcuDataMapResponseParams decode(bindings.Decoder decoder0) { | 109 static IcuDataMapResponseParams decode(bindings.Decoder decoder0) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 155 |
| 148 Map toJson() { | 156 Map toJson() { |
| 149 throw new bindings.MojoCodecError( | 157 throw new bindings.MojoCodecError( |
| 150 'Object containing handles cannot be encoded to JSON.'); | 158 'Object containing handles cannot be encoded to JSON.'); |
| 151 } | 159 } |
| 152 } | 160 } |
| 153 | 161 |
| 154 const int _icuDataMethodMapName = 0; | 162 const int _icuDataMethodMapName = 0; |
| 155 | 163 |
| 156 class _IcuDataServiceDescription implements service_describer.ServiceDescription
{ | 164 class _IcuDataServiceDescription implements service_describer.ServiceDescription
{ |
| 157 dynamic getTopLevelInterface([Function responseFactory]) => | 165 void getTopLevelInterface(Function responder) { |
| 158 responseFactory(null); | 166 responder(null); |
| 167 } |
| 159 | 168 |
| 160 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 169 void getTypeDefinition(String typeKey, Function responder) { |
| 161 responseFactory(null); | 170 responder(null); |
| 171 } |
| 162 | 172 |
| 163 dynamic getAllTypeDefinitions([Function responseFactory]) => | 173 void getAllTypeDefinitions(Function responder) { |
| 164 responseFactory(null); | 174 responder(null); |
| 175 } |
| 165 } | 176 } |
| 166 | 177 |
| 167 abstract class IcuData { | 178 abstract class IcuData { |
| 168 static const String serviceName = "icu_data::ICUData"; | 179 static const String serviceName = "icu_data::ICUData"; |
| 169 | 180 |
| 170 static service_describer.ServiceDescription _cachedServiceDescription; | 181 static service_describer.ServiceDescription _cachedServiceDescription; |
| 171 static service_describer.ServiceDescription get serviceDescription { | 182 static service_describer.ServiceDescription get serviceDescription { |
| 172 if (_cachedServiceDescription == null) { | 183 if (_cachedServiceDescription == null) { |
| 173 _cachedServiceDescription = new _IcuDataServiceDescription(); | 184 _cachedServiceDescription = new _IcuDataServiceDescription(); |
| 174 } | 185 } |
| 175 return _cachedServiceDescription; | 186 return _cachedServiceDescription; |
| 176 } | 187 } |
| 177 | 188 |
| 178 static IcuDataProxy connectToService( | 189 static IcuDataProxy connectToService( |
| 179 bindings.ServiceConnector s, String url, [String serviceName]) { | 190 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 180 IcuDataProxy p = new IcuDataProxy.unbound(); | 191 IcuDataProxy p = new IcuDataProxy.unbound(); |
| 181 String name = serviceName ?? IcuData.serviceName; | 192 String name = serviceName ?? IcuData.serviceName; |
| 182 if ((name == null) || name.isEmpty) { | 193 if ((name == null) || name.isEmpty) { |
| 183 throw new core.MojoApiError( | 194 throw new core.MojoApiError( |
| 184 "If an interface has no ServiceName, then one must be provided."); | 195 "If an interface has no ServiceName, then one must be provided."); |
| 185 } | 196 } |
| 186 s.connectToService(url, p, name); | 197 s.connectToService(url, p, name); |
| 187 return p; | 198 return p; |
| 188 } | 199 } |
| 189 dynamic map(String sha1hash,[Function responseFactory = null]); | 200 void map(String sha1hash,void callback(core.MojoSharedBuffer icuData)); |
| 190 } | 201 } |
| 191 | 202 |
| 192 abstract class IcuDataInterface | 203 abstract class IcuDataInterface |
| 193 implements bindings.MojoInterface<IcuData>, | 204 implements bindings.MojoInterface<IcuData>, |
| 194 IcuData { | 205 IcuData { |
| 195 factory IcuDataInterface([IcuData impl]) => | 206 factory IcuDataInterface([IcuData impl]) => |
| 196 new IcuDataStub.unbound(impl); | 207 new IcuDataStub.unbound(impl); |
| 197 | 208 |
| 198 factory IcuDataInterface.fromEndpoint( | 209 factory IcuDataInterface.fromEndpoint( |
| 199 core.MojoMessagePipeEndpoint endpoint, | 210 core.MojoMessagePipeEndpoint endpoint, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 229 | 240 |
| 230 void handleResponse(bindings.ServiceMessage message) { | 241 void handleResponse(bindings.ServiceMessage message) { |
| 231 switch (message.header.type) { | 242 switch (message.header.type) { |
| 232 case _icuDataMethodMapName: | 243 case _icuDataMethodMapName: |
| 233 var r = IcuDataMapResponseParams.deserialize( | 244 var r = IcuDataMapResponseParams.deserialize( |
| 234 message.payload); | 245 message.payload); |
| 235 if (!message.header.hasRequestId) { | 246 if (!message.header.hasRequestId) { |
| 236 proxyError("Expected a message with a valid request Id."); | 247 proxyError("Expected a message with a valid request Id."); |
| 237 return; | 248 return; |
| 238 } | 249 } |
| 239 Completer c = completerMap[message.header.requestId]; | 250 Function callback = callbackMap[message.header.requestId]; |
| 240 if (c == null) { | 251 if (callback == null) { |
| 241 proxyError( | 252 proxyError( |
| 242 "Message had unknown request Id: ${message.header.requestId}"); | 253 "Message had unknown request Id: ${message.header.requestId}"); |
| 243 return; | 254 return; |
| 244 } | 255 } |
| 245 completerMap.remove(message.header.requestId); | 256 callbackMap.remove(message.header.requestId); |
| 246 if (c.isCompleted) { | 257 callback(r.icuData ); |
| 247 proxyError("Response completer already completed"); | |
| 248 return; | |
| 249 } | |
| 250 c.complete(r); | |
| 251 break; | 258 break; |
| 252 default: | 259 default: |
| 253 proxyError("Unexpected message type: ${message.header.type}"); | 260 proxyError("Unexpected message type: ${message.header.type}"); |
| 254 close(immediate: true); | 261 close(immediate: true); |
| 255 break; | 262 break; |
| 256 } | 263 } |
| 257 } | 264 } |
| 258 | 265 |
| 259 @override | 266 @override |
| 260 String toString() { | 267 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 285 return newMockedProxy; | 292 return newMockedProxy; |
| 286 } | 293 } |
| 287 | 294 |
| 288 static IcuDataProxy newFromEndpoint( | 295 static IcuDataProxy newFromEndpoint( |
| 289 core.MojoMessagePipeEndpoint endpoint) { | 296 core.MojoMessagePipeEndpoint endpoint) { |
| 290 assert(endpoint.setDescription("For IcuDataProxy")); | 297 assert(endpoint.setDescription("For IcuDataProxy")); |
| 291 return new IcuDataProxy.fromEndpoint(endpoint); | 298 return new IcuDataProxy.fromEndpoint(endpoint); |
| 292 } | 299 } |
| 293 | 300 |
| 294 | 301 |
| 295 dynamic map(String sha1hash,[Function responseFactory = null]) { | 302 void map(String sha1hash,void callback(core.MojoSharedBuffer icuData)) { |
| 296 if (impl != null) { | 303 if (impl != null) { |
| 297 return new Future(() => impl.map(sha1hash,_IcuDataStubControl._icuDataMapR
esponseParamsFactory)); | 304 impl.map(sha1hash,callback); |
| 305 return; |
| 298 } | 306 } |
| 299 var params = new _IcuDataMapParams(); | 307 var params = new _IcuDataMapParams(); |
| 300 params.sha1hash = sha1hash; | 308 params.sha1hash = sha1hash; |
| 301 return ctrl.sendMessageWithRequestId( | 309 ctrl.sendMessageWithRequestId( |
| 302 params, | 310 params, |
| 303 _icuDataMethodMapName, | 311 _icuDataMethodMapName, |
| 304 -1, | 312 -1, |
| 305 bindings.MessageHeader.kMessageExpectsResponse); | 313 bindings.MessageHeader.kMessageExpectsResponse, |
| 314 callback); |
| 306 } | 315 } |
| 307 } | 316 } |
| 308 | 317 |
| 309 class _IcuDataStubControl | 318 class _IcuDataStubControl |
| 310 extends bindings.StubMessageHandler | 319 extends bindings.StubMessageHandler |
| 311 implements bindings.StubControl<IcuData> { | 320 implements bindings.StubControl<IcuData> { |
| 312 IcuData _impl; | 321 IcuData _impl; |
| 313 | 322 |
| 314 _IcuDataStubControl.fromEndpoint( | 323 _IcuDataStubControl.fromEndpoint( |
| 315 core.MojoMessagePipeEndpoint endpoint, [IcuData impl]) | 324 core.MojoMessagePipeEndpoint endpoint, [IcuData impl]) |
| 316 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 325 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 317 _impl = impl; | 326 _impl = impl; |
| 318 } | 327 } |
| 319 | 328 |
| 320 _IcuDataStubControl.fromHandle( | 329 _IcuDataStubControl.fromHandle( |
| 321 core.MojoHandle handle, [IcuData impl]) | 330 core.MojoHandle handle, [IcuData impl]) |
| 322 : super.fromHandle(handle, autoBegin: impl != null) { | 331 : super.fromHandle(handle, autoBegin: impl != null) { |
| 323 _impl = impl; | 332 _impl = impl; |
| 324 } | 333 } |
| 325 | 334 |
| 326 _IcuDataStubControl.unbound([this._impl]) : super.unbound(); | 335 _IcuDataStubControl.unbound([this._impl]) : super.unbound(); |
| 327 | 336 |
| 328 String get serviceName => IcuData.serviceName; | 337 String get serviceName => IcuData.serviceName; |
| 329 | 338 |
| 330 | 339 |
| 331 static IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoShar
edBuffer icuData) { | 340 Function _icuDataMapResponseParamsResponder( |
| 332 var result = new IcuDataMapResponseParams(); | 341 int requestId) { |
| 333 result.icuData = icuData; | 342 return (core.MojoSharedBuffer icuData) { |
| 334 return result; | 343 var result = new IcuDataMapResponseParams(); |
| 344 result.icuData = icuData; |
| 345 sendResponse(buildResponseWithId( |
| 346 result, |
| 347 _icuDataMethodMapName, |
| 348 requestId, |
| 349 bindings.MessageHeader.kMessageIsResponse)); |
| 350 }; |
| 335 } | 351 } |
| 336 | 352 |
| 337 dynamic handleMessage(bindings.ServiceMessage message) { | 353 void handleMessage(bindings.ServiceMessage message) { |
| 338 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 354 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 339 return bindings.ControlMessageHandler.handleMessage(this, | 355 bindings.ControlMessageHandler.handleMessage( |
| 340 0, | 356 this, 0, message); |
| 341 message); | 357 return; |
| 342 } | 358 } |
| 343 if (_impl == null) { | 359 if (_impl == null) { |
| 344 throw new core.MojoApiError("$this has no implementation set"); | 360 throw new core.MojoApiError("$this has no implementation set"); |
| 345 } | 361 } |
| 346 switch (message.header.type) { | 362 switch (message.header.type) { |
| 347 case _icuDataMethodMapName: | 363 case _icuDataMethodMapName: |
| 348 var params = _IcuDataMapParams.deserialize( | 364 var params = _IcuDataMapParams.deserialize( |
| 349 message.payload); | 365 message.payload); |
| 350 var response = _impl.map(params.sha1hash,_icuDataMapResponseParamsFactor
y); | 366 _impl.map(params.sha1hash, _icuDataMapResponseParamsResponder(message.he
ader.requestId)); |
| 351 if (response is Future) { | |
| 352 return response.then((response) { | |
| 353 if (response != null) { | |
| 354 return buildResponseWithId( | |
| 355 response, | |
| 356 _icuDataMethodMapName, | |
| 357 message.header.requestId, | |
| 358 bindings.MessageHeader.kMessageIsResponse); | |
| 359 } | |
| 360 }); | |
| 361 } else if (response != null) { | |
| 362 return buildResponseWithId( | |
| 363 response, | |
| 364 _icuDataMethodMapName, | |
| 365 message.header.requestId, | |
| 366 bindings.MessageHeader.kMessageIsResponse); | |
| 367 } | |
| 368 break; | 367 break; |
| 369 default: | 368 default: |
| 370 throw new bindings.MojoCodecError("Unexpected message name"); | 369 throw new bindings.MojoCodecError("Unexpected message name"); |
| 371 break; | 370 break; |
| 372 } | 371 } |
| 373 return null; | |
| 374 } | 372 } |
| 375 | 373 |
| 376 IcuData get impl => _impl; | 374 IcuData get impl => _impl; |
| 377 set impl(IcuData d) { | 375 set impl(IcuData d) { |
| 378 if (d == null) { | 376 if (d == null) { |
| 379 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 377 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 380 } | 378 } |
| 381 if (isBound && (_impl == null)) { | 379 if (isBound && (_impl == null)) { |
| 382 beginHandlingEvents(); | 380 beginHandlingEvents(); |
| 383 } | 381 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 core.MojoHandle handle, [IcuData impl]) | 415 core.MojoHandle handle, [IcuData impl]) |
| 418 : super(new _IcuDataStubControl.fromHandle(handle, impl)); | 416 : super(new _IcuDataStubControl.fromHandle(handle, impl)); |
| 419 | 417 |
| 420 static IcuDataStub newFromEndpoint( | 418 static IcuDataStub newFromEndpoint( |
| 421 core.MojoMessagePipeEndpoint endpoint) { | 419 core.MojoMessagePipeEndpoint endpoint) { |
| 422 assert(endpoint.setDescription("For IcuDataStub")); | 420 assert(endpoint.setDescription("For IcuDataStub")); |
| 423 return new IcuDataStub.fromEndpoint(endpoint); | 421 return new IcuDataStub.fromEndpoint(endpoint); |
| 424 } | 422 } |
| 425 | 423 |
| 426 | 424 |
| 427 dynamic map(String sha1hash,[Function responseFactory = null]) { | 425 void map(String sha1hash,void callback(core.MojoSharedBuffer icuData)) { |
| 428 return impl.map(sha1hash,responseFactory); | 426 return impl.map(sha1hash,callback); |
| 429 } | 427 } |
| 430 } | 428 } |
| 431 | 429 |
| 432 | 430 |
| 433 | 431 |
| OLD | NEW |