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 math_calculator_mojom; | 4 library math_calculator_mojom; |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
10 import 'package:mojo/bindings.dart' as bindings; | 10 import 'package:mojo/bindings.dart' as bindings; |
11 import 'package:mojo/core.dart' as core; | 11 import 'package:mojo/core.dart' as core; |
12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; | 12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
13 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 13 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
14 | 14 |
15 | 15 |
16 | 16 |
17 class _CalculatorClearParams extends bindings.Struct { | 17 class _CalculatorClearParams extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(8, 0) | 19 const bindings.StructDataHeader(8, 0) |
20 ]; | 20 ]; |
21 | 21 |
22 _CalculatorClearParams() : super(kVersions.last.size); | 22 _CalculatorClearParams() : super(kVersions.last.size); |
23 | 23 |
| 24 _CalculatorClearParams.init( |
| 25 ) : super(kVersions.last.size); |
| 26 |
24 static _CalculatorClearParams deserialize(bindings.Message message) { | 27 static _CalculatorClearParams deserialize(bindings.Message message) { |
25 var decoder = new bindings.Decoder(message); | 28 var decoder = new bindings.Decoder(message); |
26 var result = decode(decoder); | 29 var result = decode(decoder); |
27 if (decoder.excessHandles != null) { | 30 if (decoder.excessHandles != null) { |
28 decoder.excessHandles.forEach((h) => h.close()); | 31 decoder.excessHandles.forEach((h) => h.close()); |
29 } | 32 } |
30 return result; | 33 return result; |
31 } | 34 } |
32 | 35 |
33 static _CalculatorClearParams decode(bindings.Decoder decoder0) { | 36 static _CalculatorClearParams decode(bindings.Decoder decoder0) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 76 |
74 | 77 |
75 class CalculatorClearResponseParams extends bindings.Struct { | 78 class CalculatorClearResponseParams extends bindings.Struct { |
76 static const List<bindings.StructDataHeader> kVersions = const [ | 79 static const List<bindings.StructDataHeader> kVersions = const [ |
77 const bindings.StructDataHeader(16, 0) | 80 const bindings.StructDataHeader(16, 0) |
78 ]; | 81 ]; |
79 double value = 0.0; | 82 double value = 0.0; |
80 | 83 |
81 CalculatorClearResponseParams() : super(kVersions.last.size); | 84 CalculatorClearResponseParams() : super(kVersions.last.size); |
82 | 85 |
| 86 CalculatorClearResponseParams.init( |
| 87 double this.value |
| 88 ) : super(kVersions.last.size); |
| 89 |
83 static CalculatorClearResponseParams deserialize(bindings.Message message) { | 90 static CalculatorClearResponseParams deserialize(bindings.Message message) { |
84 var decoder = new bindings.Decoder(message); | 91 var decoder = new bindings.Decoder(message); |
85 var result = decode(decoder); | 92 var result = decode(decoder); |
86 if (decoder.excessHandles != null) { | 93 if (decoder.excessHandles != null) { |
87 decoder.excessHandles.forEach((h) => h.close()); | 94 decoder.excessHandles.forEach((h) => h.close()); |
88 } | 95 } |
89 return result; | 96 return result; |
90 } | 97 } |
91 | 98 |
92 static CalculatorClearResponseParams decode(bindings.Decoder decoder0) { | 99 static CalculatorClearResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 152 |
146 | 153 |
147 class _CalculatorAddParams extends bindings.Struct { | 154 class _CalculatorAddParams extends bindings.Struct { |
148 static const List<bindings.StructDataHeader> kVersions = const [ | 155 static const List<bindings.StructDataHeader> kVersions = const [ |
149 const bindings.StructDataHeader(16, 0) | 156 const bindings.StructDataHeader(16, 0) |
150 ]; | 157 ]; |
151 double value = 0.0; | 158 double value = 0.0; |
152 | 159 |
153 _CalculatorAddParams() : super(kVersions.last.size); | 160 _CalculatorAddParams() : super(kVersions.last.size); |
154 | 161 |
| 162 _CalculatorAddParams.init( |
| 163 double this.value |
| 164 ) : super(kVersions.last.size); |
| 165 |
155 static _CalculatorAddParams deserialize(bindings.Message message) { | 166 static _CalculatorAddParams deserialize(bindings.Message message) { |
156 var decoder = new bindings.Decoder(message); | 167 var decoder = new bindings.Decoder(message); |
157 var result = decode(decoder); | 168 var result = decode(decoder); |
158 if (decoder.excessHandles != null) { | 169 if (decoder.excessHandles != null) { |
159 decoder.excessHandles.forEach((h) => h.close()); | 170 decoder.excessHandles.forEach((h) => h.close()); |
160 } | 171 } |
161 return result; | 172 return result; |
162 } | 173 } |
163 | 174 |
164 static _CalculatorAddParams decode(bindings.Decoder decoder0) { | 175 static _CalculatorAddParams decode(bindings.Decoder decoder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 228 |
218 | 229 |
219 class CalculatorAddResponseParams extends bindings.Struct { | 230 class CalculatorAddResponseParams extends bindings.Struct { |
220 static const List<bindings.StructDataHeader> kVersions = const [ | 231 static const List<bindings.StructDataHeader> kVersions = const [ |
221 const bindings.StructDataHeader(16, 0) | 232 const bindings.StructDataHeader(16, 0) |
222 ]; | 233 ]; |
223 double value = 0.0; | 234 double value = 0.0; |
224 | 235 |
225 CalculatorAddResponseParams() : super(kVersions.last.size); | 236 CalculatorAddResponseParams() : super(kVersions.last.size); |
226 | 237 |
| 238 CalculatorAddResponseParams.init( |
| 239 double this.value |
| 240 ) : super(kVersions.last.size); |
| 241 |
227 static CalculatorAddResponseParams deserialize(bindings.Message message) { | 242 static CalculatorAddResponseParams deserialize(bindings.Message message) { |
228 var decoder = new bindings.Decoder(message); | 243 var decoder = new bindings.Decoder(message); |
229 var result = decode(decoder); | 244 var result = decode(decoder); |
230 if (decoder.excessHandles != null) { | 245 if (decoder.excessHandles != null) { |
231 decoder.excessHandles.forEach((h) => h.close()); | 246 decoder.excessHandles.forEach((h) => h.close()); |
232 } | 247 } |
233 return result; | 248 return result; |
234 } | 249 } |
235 | 250 |
236 static CalculatorAddResponseParams decode(bindings.Decoder decoder0) { | 251 static CalculatorAddResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 304 |
290 | 305 |
291 class _CalculatorMultiplyParams extends bindings.Struct { | 306 class _CalculatorMultiplyParams extends bindings.Struct { |
292 static const List<bindings.StructDataHeader> kVersions = const [ | 307 static const List<bindings.StructDataHeader> kVersions = const [ |
293 const bindings.StructDataHeader(16, 0) | 308 const bindings.StructDataHeader(16, 0) |
294 ]; | 309 ]; |
295 double value = 0.0; | 310 double value = 0.0; |
296 | 311 |
297 _CalculatorMultiplyParams() : super(kVersions.last.size); | 312 _CalculatorMultiplyParams() : super(kVersions.last.size); |
298 | 313 |
| 314 _CalculatorMultiplyParams.init( |
| 315 double this.value |
| 316 ) : super(kVersions.last.size); |
| 317 |
299 static _CalculatorMultiplyParams deserialize(bindings.Message message) { | 318 static _CalculatorMultiplyParams deserialize(bindings.Message message) { |
300 var decoder = new bindings.Decoder(message); | 319 var decoder = new bindings.Decoder(message); |
301 var result = decode(decoder); | 320 var result = decode(decoder); |
302 if (decoder.excessHandles != null) { | 321 if (decoder.excessHandles != null) { |
303 decoder.excessHandles.forEach((h) => h.close()); | 322 decoder.excessHandles.forEach((h) => h.close()); |
304 } | 323 } |
305 return result; | 324 return result; |
306 } | 325 } |
307 | 326 |
308 static _CalculatorMultiplyParams decode(bindings.Decoder decoder0) { | 327 static _CalculatorMultiplyParams decode(bindings.Decoder decoder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 380 |
362 | 381 |
363 class CalculatorMultiplyResponseParams extends bindings.Struct { | 382 class CalculatorMultiplyResponseParams extends bindings.Struct { |
364 static const List<bindings.StructDataHeader> kVersions = const [ | 383 static const List<bindings.StructDataHeader> kVersions = const [ |
365 const bindings.StructDataHeader(16, 0) | 384 const bindings.StructDataHeader(16, 0) |
366 ]; | 385 ]; |
367 double value = 0.0; | 386 double value = 0.0; |
368 | 387 |
369 CalculatorMultiplyResponseParams() : super(kVersions.last.size); | 388 CalculatorMultiplyResponseParams() : super(kVersions.last.size); |
370 | 389 |
| 390 CalculatorMultiplyResponseParams.init( |
| 391 double this.value |
| 392 ) : super(kVersions.last.size); |
| 393 |
371 static CalculatorMultiplyResponseParams deserialize(bindings.Message message)
{ | 394 static CalculatorMultiplyResponseParams deserialize(bindings.Message message)
{ |
372 var decoder = new bindings.Decoder(message); | 395 var decoder = new bindings.Decoder(message); |
373 var result = decode(decoder); | 396 var result = decode(decoder); |
374 if (decoder.excessHandles != null) { | 397 if (decoder.excessHandles != null) { |
375 decoder.excessHandles.forEach((h) => h.close()); | 398 decoder.excessHandles.forEach((h) => h.close()); |
376 } | 399 } |
377 return result; | 400 return result; |
378 } | 401 } |
379 | 402 |
380 static CalculatorMultiplyResponseParams decode(bindings.Decoder decoder0) { | 403 static CalculatorMultiplyResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 map["value"] = value; | 452 map["value"] = value; |
430 return map; | 453 return map; |
431 } | 454 } |
432 } | 455 } |
433 | 456 |
434 const int _calculatorMethodClearName = 0; | 457 const int _calculatorMethodClearName = 0; |
435 const int _calculatorMethodAddName = 1; | 458 const int _calculatorMethodAddName = 1; |
436 const int _calculatorMethodMultiplyName = 2; | 459 const int _calculatorMethodMultiplyName = 2; |
437 | 460 |
438 class _CalculatorServiceDescription implements service_describer.ServiceDescript
ion { | 461 class _CalculatorServiceDescription implements service_describer.ServiceDescript
ion { |
439 dynamic getTopLevelInterface([Function responseFactory]) => | 462 void getTopLevelInterface(Function responder) { |
440 responseFactory(null); | 463 responder(null); |
| 464 } |
441 | 465 |
442 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 466 void getTypeDefinition(String typeKey, Function responder) { |
443 responseFactory(null); | 467 responder(null); |
| 468 } |
444 | 469 |
445 dynamic getAllTypeDefinitions([Function responseFactory]) => | 470 void getAllTypeDefinitions(Function responder) { |
446 responseFactory(null); | 471 responder(null); |
| 472 } |
447 } | 473 } |
448 | 474 |
449 abstract class Calculator { | 475 abstract class Calculator { |
450 static const String serviceName = null; | 476 static const String serviceName = null; |
451 | 477 |
452 static service_describer.ServiceDescription _cachedServiceDescription; | 478 static service_describer.ServiceDescription _cachedServiceDescription; |
453 static service_describer.ServiceDescription get serviceDescription { | 479 static service_describer.ServiceDescription get serviceDescription { |
454 if (_cachedServiceDescription == null) { | 480 if (_cachedServiceDescription == null) { |
455 _cachedServiceDescription = new _CalculatorServiceDescription(); | 481 _cachedServiceDescription = new _CalculatorServiceDescription(); |
456 } | 482 } |
457 return _cachedServiceDescription; | 483 return _cachedServiceDescription; |
458 } | 484 } |
459 | 485 |
460 static CalculatorProxy connectToService( | 486 static CalculatorProxy connectToService( |
461 bindings.ServiceConnector s, String url, [String serviceName]) { | 487 bindings.ServiceConnector s, String url, [String serviceName]) { |
462 CalculatorProxy p = new CalculatorProxy.unbound(); | 488 CalculatorProxy p = new CalculatorProxy.unbound(); |
463 String name = serviceName ?? Calculator.serviceName; | 489 String name = serviceName ?? Calculator.serviceName; |
464 if ((name == null) || name.isEmpty) { | 490 if ((name == null) || name.isEmpty) { |
465 throw new core.MojoApiError( | 491 throw new core.MojoApiError( |
466 "If an interface has no ServiceName, then one must be provided."); | 492 "If an interface has no ServiceName, then one must be provided."); |
467 } | 493 } |
468 s.connectToService(url, p, name); | 494 s.connectToService(url, p, name); |
469 return p; | 495 return p; |
470 } | 496 } |
471 dynamic clear([Function responseFactory = null]); | 497 void clear(void callback(double value)); |
472 dynamic add(double value,[Function responseFactory = null]); | 498 void add(double value,void callback(double value)); |
473 dynamic multiply(double value,[Function responseFactory = null]); | 499 void multiply(double value,void callback(double value)); |
474 } | 500 } |
475 | 501 |
476 abstract class CalculatorInterface | 502 abstract class CalculatorInterface |
477 implements bindings.MojoInterface<Calculator>, | 503 implements bindings.MojoInterface<Calculator>, |
478 Calculator { | 504 Calculator { |
479 factory CalculatorInterface([Calculator impl]) => | 505 factory CalculatorInterface([Calculator impl]) => |
480 new CalculatorStub.unbound(impl); | 506 new CalculatorStub.unbound(impl); |
481 | 507 |
482 factory CalculatorInterface.fromEndpoint( | 508 factory CalculatorInterface.fromEndpoint( |
483 core.MojoMessagePipeEndpoint endpoint, | 509 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
513 | 539 |
514 void handleResponse(bindings.ServiceMessage message) { | 540 void handleResponse(bindings.ServiceMessage message) { |
515 switch (message.header.type) { | 541 switch (message.header.type) { |
516 case _calculatorMethodClearName: | 542 case _calculatorMethodClearName: |
517 var r = CalculatorClearResponseParams.deserialize( | 543 var r = CalculatorClearResponseParams.deserialize( |
518 message.payload); | 544 message.payload); |
519 if (!message.header.hasRequestId) { | 545 if (!message.header.hasRequestId) { |
520 proxyError("Expected a message with a valid request Id."); | 546 proxyError("Expected a message with a valid request Id."); |
521 return; | 547 return; |
522 } | 548 } |
523 Completer c = completerMap[message.header.requestId]; | 549 Function callback = callbackMap[message.header.requestId]; |
524 if (c == null) { | 550 if (callback == null) { |
525 proxyError( | 551 proxyError( |
526 "Message had unknown request Id: ${message.header.requestId}"); | 552 "Message had unknown request Id: ${message.header.requestId}"); |
527 return; | 553 return; |
528 } | 554 } |
529 completerMap.remove(message.header.requestId); | 555 callbackMap.remove(message.header.requestId); |
530 if (c.isCompleted) { | 556 callback(r.value ); |
531 proxyError("Response completer already completed"); | |
532 return; | |
533 } | |
534 c.complete(r); | |
535 break; | 557 break; |
536 case _calculatorMethodAddName: | 558 case _calculatorMethodAddName: |
537 var r = CalculatorAddResponseParams.deserialize( | 559 var r = CalculatorAddResponseParams.deserialize( |
538 message.payload); | 560 message.payload); |
539 if (!message.header.hasRequestId) { | 561 if (!message.header.hasRequestId) { |
540 proxyError("Expected a message with a valid request Id."); | 562 proxyError("Expected a message with a valid request Id."); |
541 return; | 563 return; |
542 } | 564 } |
543 Completer c = completerMap[message.header.requestId]; | 565 Function callback = callbackMap[message.header.requestId]; |
544 if (c == null) { | 566 if (callback == null) { |
545 proxyError( | 567 proxyError( |
546 "Message had unknown request Id: ${message.header.requestId}"); | 568 "Message had unknown request Id: ${message.header.requestId}"); |
547 return; | 569 return; |
548 } | 570 } |
549 completerMap.remove(message.header.requestId); | 571 callbackMap.remove(message.header.requestId); |
550 if (c.isCompleted) { | 572 callback(r.value ); |
551 proxyError("Response completer already completed"); | |
552 return; | |
553 } | |
554 c.complete(r); | |
555 break; | 573 break; |
556 case _calculatorMethodMultiplyName: | 574 case _calculatorMethodMultiplyName: |
557 var r = CalculatorMultiplyResponseParams.deserialize( | 575 var r = CalculatorMultiplyResponseParams.deserialize( |
558 message.payload); | 576 message.payload); |
559 if (!message.header.hasRequestId) { | 577 if (!message.header.hasRequestId) { |
560 proxyError("Expected a message with a valid request Id."); | 578 proxyError("Expected a message with a valid request Id."); |
561 return; | 579 return; |
562 } | 580 } |
563 Completer c = completerMap[message.header.requestId]; | 581 Function callback = callbackMap[message.header.requestId]; |
564 if (c == null) { | 582 if (callback == null) { |
565 proxyError( | 583 proxyError( |
566 "Message had unknown request Id: ${message.header.requestId}"); | 584 "Message had unknown request Id: ${message.header.requestId}"); |
567 return; | 585 return; |
568 } | 586 } |
569 completerMap.remove(message.header.requestId); | 587 callbackMap.remove(message.header.requestId); |
570 if (c.isCompleted) { | 588 callback(r.value ); |
571 proxyError("Response completer already completed"); | |
572 return; | |
573 } | |
574 c.complete(r); | |
575 break; | 589 break; |
576 default: | 590 default: |
577 proxyError("Unexpected message type: ${message.header.type}"); | 591 proxyError("Unexpected message type: ${message.header.type}"); |
578 close(immediate: true); | 592 close(immediate: true); |
579 break; | 593 break; |
580 } | 594 } |
581 } | 595 } |
582 | 596 |
583 @override | 597 @override |
584 String toString() { | 598 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
609 return newMockedProxy; | 623 return newMockedProxy; |
610 } | 624 } |
611 | 625 |
612 static CalculatorProxy newFromEndpoint( | 626 static CalculatorProxy newFromEndpoint( |
613 core.MojoMessagePipeEndpoint endpoint) { | 627 core.MojoMessagePipeEndpoint endpoint) { |
614 assert(endpoint.setDescription("For CalculatorProxy")); | 628 assert(endpoint.setDescription("For CalculatorProxy")); |
615 return new CalculatorProxy.fromEndpoint(endpoint); | 629 return new CalculatorProxy.fromEndpoint(endpoint); |
616 } | 630 } |
617 | 631 |
618 | 632 |
619 dynamic clear([Function responseFactory = null]) { | 633 void clear(void callback(double value)) { |
620 if (impl != null) { | 634 if (impl != null) { |
621 return new Future(() => impl.clear(_CalculatorStubControl._calculatorClear
ResponseParamsFactory)); | 635 impl.clear(callback); |
| 636 return; |
622 } | 637 } |
623 var params = new _CalculatorClearParams(); | 638 var params = new _CalculatorClearParams(); |
624 return ctrl.sendMessageWithRequestId( | 639 ctrl.sendMessageWithRequestId( |
625 params, | 640 params, |
626 _calculatorMethodClearName, | 641 _calculatorMethodClearName, |
627 -1, | 642 -1, |
628 bindings.MessageHeader.kMessageExpectsResponse); | 643 bindings.MessageHeader.kMessageExpectsResponse, |
| 644 callback); |
629 } | 645 } |
630 dynamic add(double value,[Function responseFactory = null]) { | 646 void add(double value,void callback(double value)) { |
631 if (impl != null) { | 647 if (impl != null) { |
632 return new Future(() => impl.add(value,_CalculatorStubControl._calculatorA
ddResponseParamsFactory)); | 648 impl.add(value,callback); |
| 649 return; |
633 } | 650 } |
634 var params = new _CalculatorAddParams(); | 651 var params = new _CalculatorAddParams(); |
635 params.value = value; | 652 params.value = value; |
636 return ctrl.sendMessageWithRequestId( | 653 ctrl.sendMessageWithRequestId( |
637 params, | 654 params, |
638 _calculatorMethodAddName, | 655 _calculatorMethodAddName, |
639 -1, | 656 -1, |
640 bindings.MessageHeader.kMessageExpectsResponse); | 657 bindings.MessageHeader.kMessageExpectsResponse, |
| 658 callback); |
641 } | 659 } |
642 dynamic multiply(double value,[Function responseFactory = null]) { | 660 void multiply(double value,void callback(double value)) { |
643 if (impl != null) { | 661 if (impl != null) { |
644 return new Future(() => impl.multiply(value,_CalculatorStubControl._calcul
atorMultiplyResponseParamsFactory)); | 662 impl.multiply(value,callback); |
| 663 return; |
645 } | 664 } |
646 var params = new _CalculatorMultiplyParams(); | 665 var params = new _CalculatorMultiplyParams(); |
647 params.value = value; | 666 params.value = value; |
648 return ctrl.sendMessageWithRequestId( | 667 ctrl.sendMessageWithRequestId( |
649 params, | 668 params, |
650 _calculatorMethodMultiplyName, | 669 _calculatorMethodMultiplyName, |
651 -1, | 670 -1, |
652 bindings.MessageHeader.kMessageExpectsResponse); | 671 bindings.MessageHeader.kMessageExpectsResponse, |
| 672 callback); |
653 } | 673 } |
654 } | 674 } |
655 | 675 |
656 class _CalculatorStubControl | 676 class _CalculatorStubControl |
657 extends bindings.StubMessageHandler | 677 extends bindings.StubMessageHandler |
658 implements bindings.StubControl<Calculator> { | 678 implements bindings.StubControl<Calculator> { |
659 Calculator _impl; | 679 Calculator _impl; |
660 | 680 |
661 _CalculatorStubControl.fromEndpoint( | 681 _CalculatorStubControl.fromEndpoint( |
662 core.MojoMessagePipeEndpoint endpoint, [Calculator impl]) | 682 core.MojoMessagePipeEndpoint endpoint, [Calculator impl]) |
663 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 683 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
664 _impl = impl; | 684 _impl = impl; |
665 } | 685 } |
666 | 686 |
667 _CalculatorStubControl.fromHandle( | 687 _CalculatorStubControl.fromHandle( |
668 core.MojoHandle handle, [Calculator impl]) | 688 core.MojoHandle handle, [Calculator impl]) |
669 : super.fromHandle(handle, autoBegin: impl != null) { | 689 : super.fromHandle(handle, autoBegin: impl != null) { |
670 _impl = impl; | 690 _impl = impl; |
671 } | 691 } |
672 | 692 |
673 _CalculatorStubControl.unbound([this._impl]) : super.unbound(); | 693 _CalculatorStubControl.unbound([this._impl]) : super.unbound(); |
674 | 694 |
675 String get serviceName => Calculator.serviceName; | 695 String get serviceName => Calculator.serviceName; |
676 | 696 |
677 | 697 |
678 static CalculatorClearResponseParams _calculatorClearResponseParamsFactory(dou
ble value) { | 698 Function _calculatorClearResponseParamsResponder( |
679 var result = new CalculatorClearResponseParams(); | 699 int requestId) { |
680 result.value = value; | 700 return (double value) { |
681 return result; | 701 var result = new CalculatorClearResponseParams(); |
| 702 result.value = value; |
| 703 sendResponse(buildResponseWithId( |
| 704 result, |
| 705 _calculatorMethodClearName, |
| 706 requestId, |
| 707 bindings.MessageHeader.kMessageIsResponse)); |
| 708 }; |
682 } | 709 } |
683 static CalculatorAddResponseParams _calculatorAddResponseParamsFactory(double
value) { | 710 Function _calculatorAddResponseParamsResponder( |
684 var result = new CalculatorAddResponseParams(); | 711 int requestId) { |
685 result.value = value; | 712 return (double value) { |
686 return result; | 713 var result = new CalculatorAddResponseParams(); |
| 714 result.value = value; |
| 715 sendResponse(buildResponseWithId( |
| 716 result, |
| 717 _calculatorMethodAddName, |
| 718 requestId, |
| 719 bindings.MessageHeader.kMessageIsResponse)); |
| 720 }; |
687 } | 721 } |
688 static CalculatorMultiplyResponseParams _calculatorMultiplyResponseParamsFacto
ry(double value) { | 722 Function _calculatorMultiplyResponseParamsResponder( |
689 var result = new CalculatorMultiplyResponseParams(); | 723 int requestId) { |
690 result.value = value; | 724 return (double value) { |
691 return result; | 725 var result = new CalculatorMultiplyResponseParams(); |
| 726 result.value = value; |
| 727 sendResponse(buildResponseWithId( |
| 728 result, |
| 729 _calculatorMethodMultiplyName, |
| 730 requestId, |
| 731 bindings.MessageHeader.kMessageIsResponse)); |
| 732 }; |
692 } | 733 } |
693 | 734 |
694 dynamic handleMessage(bindings.ServiceMessage message) { | 735 void handleMessage(bindings.ServiceMessage message) { |
695 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 736 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
696 return bindings.ControlMessageHandler.handleMessage(this, | 737 bindings.ControlMessageHandler.handleMessage( |
697 0, | 738 this, 0, message); |
698 message); | 739 return; |
699 } | 740 } |
700 if (_impl == null) { | 741 if (_impl == null) { |
701 throw new core.MojoApiError("$this has no implementation set"); | 742 throw new core.MojoApiError("$this has no implementation set"); |
702 } | 743 } |
703 switch (message.header.type) { | 744 switch (message.header.type) { |
704 case _calculatorMethodClearName: | 745 case _calculatorMethodClearName: |
705 var response = _impl.clear(_calculatorClearResponseParamsFactory); | 746 _impl.clear(_calculatorClearResponseParamsResponder(message.header.reque
stId)); |
706 if (response is Future) { | |
707 return response.then((response) { | |
708 if (response != null) { | |
709 return buildResponseWithId( | |
710 response, | |
711 _calculatorMethodClearName, | |
712 message.header.requestId, | |
713 bindings.MessageHeader.kMessageIsResponse); | |
714 } | |
715 }); | |
716 } else if (response != null) { | |
717 return buildResponseWithId( | |
718 response, | |
719 _calculatorMethodClearName, | |
720 message.header.requestId, | |
721 bindings.MessageHeader.kMessageIsResponse); | |
722 } | |
723 break; | 747 break; |
724 case _calculatorMethodAddName: | 748 case _calculatorMethodAddName: |
725 var params = _CalculatorAddParams.deserialize( | 749 var params = _CalculatorAddParams.deserialize( |
726 message.payload); | 750 message.payload); |
727 var response = _impl.add(params.value,_calculatorAddResponseParamsFactor
y); | 751 _impl.add(params.value, _calculatorAddResponseParamsResponder(message.he
ader.requestId)); |
728 if (response is Future) { | |
729 return response.then((response) { | |
730 if (response != null) { | |
731 return buildResponseWithId( | |
732 response, | |
733 _calculatorMethodAddName, | |
734 message.header.requestId, | |
735 bindings.MessageHeader.kMessageIsResponse); | |
736 } | |
737 }); | |
738 } else if (response != null) { | |
739 return buildResponseWithId( | |
740 response, | |
741 _calculatorMethodAddName, | |
742 message.header.requestId, | |
743 bindings.MessageHeader.kMessageIsResponse); | |
744 } | |
745 break; | 752 break; |
746 case _calculatorMethodMultiplyName: | 753 case _calculatorMethodMultiplyName: |
747 var params = _CalculatorMultiplyParams.deserialize( | 754 var params = _CalculatorMultiplyParams.deserialize( |
748 message.payload); | 755 message.payload); |
749 var response = _impl.multiply(params.value,_calculatorMultiplyResponsePa
ramsFactory); | 756 _impl.multiply(params.value, _calculatorMultiplyResponseParamsResponder(
message.header.requestId)); |
750 if (response is Future) { | |
751 return response.then((response) { | |
752 if (response != null) { | |
753 return buildResponseWithId( | |
754 response, | |
755 _calculatorMethodMultiplyName, | |
756 message.header.requestId, | |
757 bindings.MessageHeader.kMessageIsResponse); | |
758 } | |
759 }); | |
760 } else if (response != null) { | |
761 return buildResponseWithId( | |
762 response, | |
763 _calculatorMethodMultiplyName, | |
764 message.header.requestId, | |
765 bindings.MessageHeader.kMessageIsResponse); | |
766 } | |
767 break; | 757 break; |
768 default: | 758 default: |
769 throw new bindings.MojoCodecError("Unexpected message name"); | 759 throw new bindings.MojoCodecError("Unexpected message name"); |
770 break; | 760 break; |
771 } | 761 } |
772 return null; | |
773 } | 762 } |
774 | 763 |
775 Calculator get impl => _impl; | 764 Calculator get impl => _impl; |
776 set impl(Calculator d) { | 765 set impl(Calculator d) { |
777 if (d == null) { | 766 if (d == null) { |
778 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 767 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
779 } | 768 } |
780 if (isBound && (_impl == null)) { | 769 if (isBound && (_impl == null)) { |
781 beginHandlingEvents(); | 770 beginHandlingEvents(); |
782 } | 771 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 core.MojoHandle handle, [Calculator impl]) | 805 core.MojoHandle handle, [Calculator impl]) |
817 : super(new _CalculatorStubControl.fromHandle(handle, impl)); | 806 : super(new _CalculatorStubControl.fromHandle(handle, impl)); |
818 | 807 |
819 static CalculatorStub newFromEndpoint( | 808 static CalculatorStub newFromEndpoint( |
820 core.MojoMessagePipeEndpoint endpoint) { | 809 core.MojoMessagePipeEndpoint endpoint) { |
821 assert(endpoint.setDescription("For CalculatorStub")); | 810 assert(endpoint.setDescription("For CalculatorStub")); |
822 return new CalculatorStub.fromEndpoint(endpoint); | 811 return new CalculatorStub.fromEndpoint(endpoint); |
823 } | 812 } |
824 | 813 |
825 | 814 |
826 dynamic clear([Function responseFactory = null]) { | 815 void clear(void callback(double value)) { |
827 return impl.clear(responseFactory); | 816 return impl.clear(callback); |
828 } | 817 } |
829 dynamic add(double value,[Function responseFactory = null]) { | 818 void add(double value,void callback(double value)) { |
830 return impl.add(value,responseFactory); | 819 return impl.add(value,callback); |
831 } | 820 } |
832 dynamic multiply(double value,[Function responseFactory = null]) { | 821 void multiply(double value,void callback(double value)) { |
833 return impl.multiply(value,responseFactory); | 822 return impl.multiply(value,callback); |
834 } | 823 } |
835 } | 824 } |
836 | 825 |
837 | 826 |
838 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? | 827 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? |
839 _initRuntimeTypeInfo(); | 828 _initRuntimeTypeInfo(); |
840 | 829 |
841 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { | 830 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
842 return getRuntimeTypeInfo().typeMap; | 831 return getRuntimeTypeInfo().typeMap; |
843 } | 832 } |
844 | 833 |
845 var _runtimeTypeInfo; | 834 var _runtimeTypeInfo; |
846 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { | 835 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { |
847 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of | 836 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of |
848 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this | 837 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this |
849 // file. The string contains the base64 encoding of the gzip-compressed bytes. | 838 // file. The string contains the base64 encoding of the gzip-compressed bytes. |
850 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xXTWvyQBA2+r4Q9f3w/WhNb0IvXup6l
J4sRSiUgodehILEZFtT8mHzUeg/6c/z2GOPvbWbZlbXaRYjKNqSgWGa7Q6Z5+GZJ6gVkqhBbUPF57yqq
OJ7HeFZEe414O7loN8bnvcGx44ejlunum1Eth56vgb3476S0NcU+sV4Qc9d9NxG568QZ4X0+MuywnI+U
XJeZ/mbJRr3A24V+q9ijCzJ2HMo8SPTcyyX+sTxbj0S+EbyxyQa2ZZBLDek/rVu0ICMLNe03JuAhDQIA
xK/bmjMXteKu5w0vjkv/4G3AvBYFP5fEvr635L6WE7nd8r5VbLxi6MpOf/J8nvMr011PwVHGWbeNH8Np
Nspqstwch3J8O8B1necRz69i9g8KXh5bBqvKtlHDc2hIh1gfp6V9fCzz/KXwE8w8dyAbo8fzEs3xcf4T
mWJde3JvW5HVLIn9S3wIupFEeaR+YdaWuRtGS8KpIyXKvjYiWmmfncqW/aPde3HP8DKcAruke9H1v2ow
Pd6V/Zj03qJv/s/ZnrhbprrZRW9HH4iPy1m5KUIKeOlBrNcRHZoTewHzEv1i/ipBpg4Tm6q+X5k248qe
Myu+ukT+r2SVS8dCR8HLP8s6mVuqrmvrqSb5g7p5i0AAP//5ns7IOgQAAA="; | 839 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xXTY/TMBBtU5CyLR/lc8OtEpdeWK84r
TgtQishISQOXHoqbmraICcOcYIEv5Zjj/wDcNpx6wwx/aC0YZWRRtM4tjLv9c1L6zUW0YV6DhWv6+qii
vddGNdNY18P9r4fvLsavrkavAhpOj17RbmfcZqKxIP9+bmWca5vnC9Es3h5iW6fo/WfEK8b5XFfZVvlq
qPF+qnKuypRu7/hduH8VOUHlSSTCeHCp5xMhJhwRqYiZORbQkkoPonnRCb+/BOJsxEPfBJEKUs+Up9JM
gqicRBNJEmZTCXJHz30l48+y0+F+Pman4fAn6bIMe63jO8rvrGo30/KeZ5pXM5mPOPoW9Zvq7yZ88wZT
Ur0cwI9H4rHHtLxDNV1eLWubDw8AsxzvM8S9jlTvZTg1nEo3K5lTj3Uj4t0gXnSAvtbnh6rvGPwJGMRS
XZ8njA/lyU+V2JH1tjX/HyhPGOW+Tk9Ij8esuhu48/+0msV+VvHTxPSxk8HfO7leFz6fmpXxF/2NTcPA
LPCa7hLPTfbzk0b3vNVm5t/rZ/898KtpX6069b62UU/T/9D33U25MeBtPHThV7eZjwNYv4V89O5Zr7rA
TaNV5tvPTfbzU0HPKjqvvsD/R/aVD8XFl6eqLxX1M/KfGv/3UlH/Qrq6FcAAAD//4oDU5NgEQAA"; |
851 | 840 |
852 // Deserialize RuntimeTypeInfo | 841 // Deserialize RuntimeTypeInfo |
853 var bytes = BASE64.decode(serializedRuntimeTypeInfo); | 842 var bytes = BASE64.decode(serializedRuntimeTypeInfo); |
854 var unzippedBytes = new ZLibDecoder().convert(bytes); | 843 var unzippedBytes = new ZLibDecoder().convert(bytes); |
855 var bdata = new ByteData.view(unzippedBytes.buffer); | 844 var bdata = new ByteData.view(unzippedBytes.buffer); |
856 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); | 845 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); |
857 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); | 846 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); |
858 return _runtimeTypeInfo; | 847 return _runtimeTypeInfo; |
859 } | 848 } |
OLD | NEW |