| 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 prediction_mojom; | 4 library prediction_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 PrevWordInfo extends bindings.Struct { | 12 class PrevWordInfo 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 word = null; | 16 String word = null; |
| 17 bool isBeginningOfSentence = false; | 17 bool isBeginningOfSentence = false; |
| 18 | 18 |
| 19 PrevWordInfo() : super(kVersions.last.size); | 19 PrevWordInfo() : super(kVersions.last.size); |
| 20 | 20 |
| 21 PrevWordInfo.init( |
| 22 String this.word, |
| 23 bool this.isBeginningOfSentence |
| 24 ) : super(kVersions.last.size); |
| 25 |
| 21 static PrevWordInfo deserialize(bindings.Message message) { | 26 static PrevWordInfo deserialize(bindings.Message message) { |
| 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 PrevWordInfo decode(bindings.Decoder decoder0) { | 35 static PrevWordInfo decode(bindings.Decoder decoder0) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 102 |
| 98 class PredictionInfo extends bindings.Struct { | 103 class PredictionInfo extends bindings.Struct { |
| 99 static const List<bindings.StructDataHeader> kVersions = const [ | 104 static const List<bindings.StructDataHeader> kVersions = const [ |
| 100 const bindings.StructDataHeader(24, 0) | 105 const bindings.StructDataHeader(24, 0) |
| 101 ]; | 106 ]; |
| 102 List<PrevWordInfo> previousWords = null; | 107 List<PrevWordInfo> previousWords = null; |
| 103 String currentWord = null; | 108 String currentWord = null; |
| 104 | 109 |
| 105 PredictionInfo() : super(kVersions.last.size); | 110 PredictionInfo() : super(kVersions.last.size); |
| 106 | 111 |
| 112 PredictionInfo.init( |
| 113 List<PrevWordInfo> this.previousWords, |
| 114 String this.currentWord |
| 115 ) : super(kVersions.last.size); |
| 116 |
| 107 static PredictionInfo deserialize(bindings.Message message) { | 117 static PredictionInfo deserialize(bindings.Message message) { |
| 108 var decoder = new bindings.Decoder(message); | 118 var decoder = new bindings.Decoder(message); |
| 109 var result = decode(decoder); | 119 var result = decode(decoder); |
| 110 if (decoder.excessHandles != null) { | 120 if (decoder.excessHandles != null) { |
| 111 decoder.excessHandles.forEach((h) => h.close()); | 121 decoder.excessHandles.forEach((h) => h.close()); |
| 112 } | 122 } |
| 113 return result; | 123 return result; |
| 114 } | 124 } |
| 115 | 125 |
| 116 static PredictionInfo decode(bindings.Decoder decoder0) { | 126 static PredictionInfo decode(bindings.Decoder decoder0) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 208 |
| 199 | 209 |
| 200 class _PredictionServiceGetPredictionListParams extends bindings.Struct { | 210 class _PredictionServiceGetPredictionListParams extends bindings.Struct { |
| 201 static const List<bindings.StructDataHeader> kVersions = const [ | 211 static const List<bindings.StructDataHeader> kVersions = const [ |
| 202 const bindings.StructDataHeader(16, 0) | 212 const bindings.StructDataHeader(16, 0) |
| 203 ]; | 213 ]; |
| 204 PredictionInfo predictionInfo = null; | 214 PredictionInfo predictionInfo = null; |
| 205 | 215 |
| 206 _PredictionServiceGetPredictionListParams() : super(kVersions.last.size); | 216 _PredictionServiceGetPredictionListParams() : super(kVersions.last.size); |
| 207 | 217 |
| 218 _PredictionServiceGetPredictionListParams.init( |
| 219 PredictionInfo this.predictionInfo |
| 220 ) : super(kVersions.last.size); |
| 221 |
| 208 static _PredictionServiceGetPredictionListParams deserialize(bindings.Message
message) { | 222 static _PredictionServiceGetPredictionListParams deserialize(bindings.Message
message) { |
| 209 var decoder = new bindings.Decoder(message); | 223 var decoder = new bindings.Decoder(message); |
| 210 var result = decode(decoder); | 224 var result = decode(decoder); |
| 211 if (decoder.excessHandles != null) { | 225 if (decoder.excessHandles != null) { |
| 212 decoder.excessHandles.forEach((h) => h.close()); | 226 decoder.excessHandles.forEach((h) => h.close()); |
| 213 } | 227 } |
| 214 return result; | 228 return result; |
| 215 } | 229 } |
| 216 | 230 |
| 217 static _PredictionServiceGetPredictionListParams decode(bindings.Decoder decod
er0) { | 231 static _PredictionServiceGetPredictionListParams decode(bindings.Decoder decod
er0) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 285 |
| 272 | 286 |
| 273 class PredictionServiceGetPredictionListResponseParams extends bindings.Struct { | 287 class PredictionServiceGetPredictionListResponseParams extends bindings.Struct { |
| 274 static const List<bindings.StructDataHeader> kVersions = const [ | 288 static const List<bindings.StructDataHeader> kVersions = const [ |
| 275 const bindings.StructDataHeader(16, 0) | 289 const bindings.StructDataHeader(16, 0) |
| 276 ]; | 290 ]; |
| 277 List<String> predictionList = null; | 291 List<String> predictionList = null; |
| 278 | 292 |
| 279 PredictionServiceGetPredictionListResponseParams() : super(kVersions.last.size
); | 293 PredictionServiceGetPredictionListResponseParams() : super(kVersions.last.size
); |
| 280 | 294 |
| 295 PredictionServiceGetPredictionListResponseParams.init( |
| 296 List<String> this.predictionList |
| 297 ) : super(kVersions.last.size); |
| 298 |
| 281 static PredictionServiceGetPredictionListResponseParams deserialize(bindings.M
essage message) { | 299 static PredictionServiceGetPredictionListResponseParams deserialize(bindings.M
essage message) { |
| 282 var decoder = new bindings.Decoder(message); | 300 var decoder = new bindings.Decoder(message); |
| 283 var result = decode(decoder); | 301 var result = decode(decoder); |
| 284 if (decoder.excessHandles != null) { | 302 if (decoder.excessHandles != null) { |
| 285 decoder.excessHandles.forEach((h) => h.close()); | 303 decoder.excessHandles.forEach((h) => h.close()); |
| 286 } | 304 } |
| 287 return result; | 305 return result; |
| 288 } | 306 } |
| 289 | 307 |
| 290 static PredictionServiceGetPredictionListResponseParams decode(bindings.Decode
r decoder0) { | 308 static PredictionServiceGetPredictionListResponseParams decode(bindings.Decode
r decoder0) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Map toJson() { | 372 Map toJson() { |
| 355 Map map = new Map(); | 373 Map map = new Map(); |
| 356 map["predictionList"] = predictionList; | 374 map["predictionList"] = predictionList; |
| 357 return map; | 375 return map; |
| 358 } | 376 } |
| 359 } | 377 } |
| 360 | 378 |
| 361 const int _predictionServiceMethodGetPredictionListName = 0; | 379 const int _predictionServiceMethodGetPredictionListName = 0; |
| 362 | 380 |
| 363 class _PredictionServiceServiceDescription implements service_describer.ServiceD
escription { | 381 class _PredictionServiceServiceDescription implements service_describer.ServiceD
escription { |
| 364 dynamic getTopLevelInterface([Function responseFactory]) => | 382 void getTopLevelInterface(Function responder) { |
| 365 responseFactory(null); | 383 responder(null); |
| 384 } |
| 366 | 385 |
| 367 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 386 void getTypeDefinition(String typeKey, Function responder) { |
| 368 responseFactory(null); | 387 responder(null); |
| 388 } |
| 369 | 389 |
| 370 dynamic getAllTypeDefinitions([Function responseFactory]) => | 390 void getAllTypeDefinitions(Function responder) { |
| 371 responseFactory(null); | 391 responder(null); |
| 392 } |
| 372 } | 393 } |
| 373 | 394 |
| 374 abstract class PredictionService { | 395 abstract class PredictionService { |
| 375 static const String serviceName = "prediction::PredictionService"; | 396 static const String serviceName = "prediction::PredictionService"; |
| 376 | 397 |
| 377 static service_describer.ServiceDescription _cachedServiceDescription; | 398 static service_describer.ServiceDescription _cachedServiceDescription; |
| 378 static service_describer.ServiceDescription get serviceDescription { | 399 static service_describer.ServiceDescription get serviceDescription { |
| 379 if (_cachedServiceDescription == null) { | 400 if (_cachedServiceDescription == null) { |
| 380 _cachedServiceDescription = new _PredictionServiceServiceDescription(); | 401 _cachedServiceDescription = new _PredictionServiceServiceDescription(); |
| 381 } | 402 } |
| 382 return _cachedServiceDescription; | 403 return _cachedServiceDescription; |
| 383 } | 404 } |
| 384 | 405 |
| 385 static PredictionServiceProxy connectToService( | 406 static PredictionServiceProxy connectToService( |
| 386 bindings.ServiceConnector s, String url, [String serviceName]) { | 407 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 387 PredictionServiceProxy p = new PredictionServiceProxy.unbound(); | 408 PredictionServiceProxy p = new PredictionServiceProxy.unbound(); |
| 388 String name = serviceName ?? PredictionService.serviceName; | 409 String name = serviceName ?? PredictionService.serviceName; |
| 389 if ((name == null) || name.isEmpty) { | 410 if ((name == null) || name.isEmpty) { |
| 390 throw new core.MojoApiError( | 411 throw new core.MojoApiError( |
| 391 "If an interface has no ServiceName, then one must be provided."); | 412 "If an interface has no ServiceName, then one must be provided."); |
| 392 } | 413 } |
| 393 s.connectToService(url, p, name); | 414 s.connectToService(url, p, name); |
| 394 return p; | 415 return p; |
| 395 } | 416 } |
| 396 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact
ory = null]); | 417 void getPredictionList(PredictionInfo predictionInfo,void callback(List<String
> predictionList)); |
| 397 } | 418 } |
| 398 | 419 |
| 399 abstract class PredictionServiceInterface | 420 abstract class PredictionServiceInterface |
| 400 implements bindings.MojoInterface<PredictionService>, | 421 implements bindings.MojoInterface<PredictionService>, |
| 401 PredictionService { | 422 PredictionService { |
| 402 factory PredictionServiceInterface([PredictionService impl]) => | 423 factory PredictionServiceInterface([PredictionService impl]) => |
| 403 new PredictionServiceStub.unbound(impl); | 424 new PredictionServiceStub.unbound(impl); |
| 404 | 425 |
| 405 factory PredictionServiceInterface.fromEndpoint( | 426 factory PredictionServiceInterface.fromEndpoint( |
| 406 core.MojoMessagePipeEndpoint endpoint, | 427 core.MojoMessagePipeEndpoint endpoint, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 436 | 457 |
| 437 void handleResponse(bindings.ServiceMessage message) { | 458 void handleResponse(bindings.ServiceMessage message) { |
| 438 switch (message.header.type) { | 459 switch (message.header.type) { |
| 439 case _predictionServiceMethodGetPredictionListName: | 460 case _predictionServiceMethodGetPredictionListName: |
| 440 var r = PredictionServiceGetPredictionListResponseParams.deserialize( | 461 var r = PredictionServiceGetPredictionListResponseParams.deserialize( |
| 441 message.payload); | 462 message.payload); |
| 442 if (!message.header.hasRequestId) { | 463 if (!message.header.hasRequestId) { |
| 443 proxyError("Expected a message with a valid request Id."); | 464 proxyError("Expected a message with a valid request Id."); |
| 444 return; | 465 return; |
| 445 } | 466 } |
| 446 Completer c = completerMap[message.header.requestId]; | 467 Function callback = callbackMap[message.header.requestId]; |
| 447 if (c == null) { | 468 if (callback == null) { |
| 448 proxyError( | 469 proxyError( |
| 449 "Message had unknown request Id: ${message.header.requestId}"); | 470 "Message had unknown request Id: ${message.header.requestId}"); |
| 450 return; | 471 return; |
| 451 } | 472 } |
| 452 completerMap.remove(message.header.requestId); | 473 callbackMap.remove(message.header.requestId); |
| 453 if (c.isCompleted) { | 474 callback(r.predictionList ); |
| 454 proxyError("Response completer already completed"); | |
| 455 return; | |
| 456 } | |
| 457 c.complete(r); | |
| 458 break; | 475 break; |
| 459 default: | 476 default: |
| 460 proxyError("Unexpected message type: ${message.header.type}"); | 477 proxyError("Unexpected message type: ${message.header.type}"); |
| 461 close(immediate: true); | 478 close(immediate: true); |
| 462 break; | 479 break; |
| 463 } | 480 } |
| 464 } | 481 } |
| 465 | 482 |
| 466 @override | 483 @override |
| 467 String toString() { | 484 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 492 return newMockedProxy; | 509 return newMockedProxy; |
| 493 } | 510 } |
| 494 | 511 |
| 495 static PredictionServiceProxy newFromEndpoint( | 512 static PredictionServiceProxy newFromEndpoint( |
| 496 core.MojoMessagePipeEndpoint endpoint) { | 513 core.MojoMessagePipeEndpoint endpoint) { |
| 497 assert(endpoint.setDescription("For PredictionServiceProxy")); | 514 assert(endpoint.setDescription("For PredictionServiceProxy")); |
| 498 return new PredictionServiceProxy.fromEndpoint(endpoint); | 515 return new PredictionServiceProxy.fromEndpoint(endpoint); |
| 499 } | 516 } |
| 500 | 517 |
| 501 | 518 |
| 502 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact
ory = null]) { | 519 void getPredictionList(PredictionInfo predictionInfo,void callback(List<String
> predictionList)) { |
| 503 if (impl != null) { | 520 if (impl != null) { |
| 504 return new Future(() => impl.getPredictionList(predictionInfo,_PredictionS
erviceStubControl._predictionServiceGetPredictionListResponseParamsFactory)); | 521 impl.getPredictionList(predictionInfo,callback); |
| 522 return; |
| 505 } | 523 } |
| 506 var params = new _PredictionServiceGetPredictionListParams(); | 524 var params = new _PredictionServiceGetPredictionListParams(); |
| 507 params.predictionInfo = predictionInfo; | 525 params.predictionInfo = predictionInfo; |
| 508 return ctrl.sendMessageWithRequestId( | 526 ctrl.sendMessageWithRequestId( |
| 509 params, | 527 params, |
| 510 _predictionServiceMethodGetPredictionListName, | 528 _predictionServiceMethodGetPredictionListName, |
| 511 -1, | 529 -1, |
| 512 bindings.MessageHeader.kMessageExpectsResponse); | 530 bindings.MessageHeader.kMessageExpectsResponse, |
| 531 callback); |
| 513 } | 532 } |
| 514 } | 533 } |
| 515 | 534 |
| 516 class _PredictionServiceStubControl | 535 class _PredictionServiceStubControl |
| 517 extends bindings.StubMessageHandler | 536 extends bindings.StubMessageHandler |
| 518 implements bindings.StubControl<PredictionService> { | 537 implements bindings.StubControl<PredictionService> { |
| 519 PredictionService _impl; | 538 PredictionService _impl; |
| 520 | 539 |
| 521 _PredictionServiceStubControl.fromEndpoint( | 540 _PredictionServiceStubControl.fromEndpoint( |
| 522 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl]) | 541 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl]) |
| 523 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 542 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 524 _impl = impl; | 543 _impl = impl; |
| 525 } | 544 } |
| 526 | 545 |
| 527 _PredictionServiceStubControl.fromHandle( | 546 _PredictionServiceStubControl.fromHandle( |
| 528 core.MojoHandle handle, [PredictionService impl]) | 547 core.MojoHandle handle, [PredictionService impl]) |
| 529 : super.fromHandle(handle, autoBegin: impl != null) { | 548 : super.fromHandle(handle, autoBegin: impl != null) { |
| 530 _impl = impl; | 549 _impl = impl; |
| 531 } | 550 } |
| 532 | 551 |
| 533 _PredictionServiceStubControl.unbound([this._impl]) : super.unbound(); | 552 _PredictionServiceStubControl.unbound([this._impl]) : super.unbound(); |
| 534 | 553 |
| 535 String get serviceName => PredictionService.serviceName; | 554 String get serviceName => PredictionService.serviceName; |
| 536 | 555 |
| 537 | 556 |
| 538 static PredictionServiceGetPredictionListResponseParams _predictionServiceGetP
redictionListResponseParamsFactory(List<String> predictionList) { | 557 Function _predictionServiceGetPredictionListResponseParamsResponder( |
| 539 var result = new PredictionServiceGetPredictionListResponseParams(); | 558 int requestId) { |
| 540 result.predictionList = predictionList; | 559 return (List<String> predictionList) { |
| 541 return result; | 560 var result = new PredictionServiceGetPredictionListResponseParams(); |
| 561 result.predictionList = predictionList; |
| 562 sendResponse(buildResponseWithId( |
| 563 result, |
| 564 _predictionServiceMethodGetPredictionListName, |
| 565 requestId, |
| 566 bindings.MessageHeader.kMessageIsResponse)); |
| 567 }; |
| 542 } | 568 } |
| 543 | 569 |
| 544 dynamic handleMessage(bindings.ServiceMessage message) { | 570 void handleMessage(bindings.ServiceMessage message) { |
| 545 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 571 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 546 return bindings.ControlMessageHandler.handleMessage(this, | 572 bindings.ControlMessageHandler.handleMessage( |
| 547 0, | 573 this, 0, message); |
| 548 message); | 574 return; |
| 549 } | 575 } |
| 550 if (_impl == null) { | 576 if (_impl == null) { |
| 551 throw new core.MojoApiError("$this has no implementation set"); | 577 throw new core.MojoApiError("$this has no implementation set"); |
| 552 } | 578 } |
| 553 switch (message.header.type) { | 579 switch (message.header.type) { |
| 554 case _predictionServiceMethodGetPredictionListName: | 580 case _predictionServiceMethodGetPredictionListName: |
| 555 var params = _PredictionServiceGetPredictionListParams.deserialize( | 581 var params = _PredictionServiceGetPredictionListParams.deserialize( |
| 556 message.payload); | 582 message.payload); |
| 557 var response = _impl.getPredictionList(params.predictionInfo,_prediction
ServiceGetPredictionListResponseParamsFactory); | 583 _impl.getPredictionList(params.predictionInfo, _predictionServiceGetPred
ictionListResponseParamsResponder(message.header.requestId)); |
| 558 if (response is Future) { | |
| 559 return response.then((response) { | |
| 560 if (response != null) { | |
| 561 return buildResponseWithId( | |
| 562 response, | |
| 563 _predictionServiceMethodGetPredictionListName, | |
| 564 message.header.requestId, | |
| 565 bindings.MessageHeader.kMessageIsResponse); | |
| 566 } | |
| 567 }); | |
| 568 } else if (response != null) { | |
| 569 return buildResponseWithId( | |
| 570 response, | |
| 571 _predictionServiceMethodGetPredictionListName, | |
| 572 message.header.requestId, | |
| 573 bindings.MessageHeader.kMessageIsResponse); | |
| 574 } | |
| 575 break; | 584 break; |
| 576 default: | 585 default: |
| 577 throw new bindings.MojoCodecError("Unexpected message name"); | 586 throw new bindings.MojoCodecError("Unexpected message name"); |
| 578 break; | 587 break; |
| 579 } | 588 } |
| 580 return null; | |
| 581 } | 589 } |
| 582 | 590 |
| 583 PredictionService get impl => _impl; | 591 PredictionService get impl => _impl; |
| 584 set impl(PredictionService d) { | 592 set impl(PredictionService d) { |
| 585 if (d == null) { | 593 if (d == null) { |
| 586 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 594 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 587 } | 595 } |
| 588 if (isBound && (_impl == null)) { | 596 if (isBound && (_impl == null)) { |
| 589 beginHandlingEvents(); | 597 beginHandlingEvents(); |
| 590 } | 598 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 core.MojoHandle handle, [PredictionService impl]) | 632 core.MojoHandle handle, [PredictionService impl]) |
| 625 : super(new _PredictionServiceStubControl.fromHandle(handle, impl)); | 633 : super(new _PredictionServiceStubControl.fromHandle(handle, impl)); |
| 626 | 634 |
| 627 static PredictionServiceStub newFromEndpoint( | 635 static PredictionServiceStub newFromEndpoint( |
| 628 core.MojoMessagePipeEndpoint endpoint) { | 636 core.MojoMessagePipeEndpoint endpoint) { |
| 629 assert(endpoint.setDescription("For PredictionServiceStub")); | 637 assert(endpoint.setDescription("For PredictionServiceStub")); |
| 630 return new PredictionServiceStub.fromEndpoint(endpoint); | 638 return new PredictionServiceStub.fromEndpoint(endpoint); |
| 631 } | 639 } |
| 632 | 640 |
| 633 | 641 |
| 634 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact
ory = null]) { | 642 void getPredictionList(PredictionInfo predictionInfo,void callback(List<String
> predictionList)) { |
| 635 return impl.getPredictionList(predictionInfo,responseFactory); | 643 return impl.getPredictionList(predictionInfo,callback); |
| 636 } | 644 } |
| 637 } | 645 } |
| 638 | 646 |
| 639 | 647 |
| 640 | 648 |
| OLD | NEW |