OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 library math_calculator_mojom; | 5 library math_calculator_mojom; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 responseFactory(null); | 447 responseFactory(null); |
448 } | 448 } |
449 | 449 |
450 abstract class Calculator { | 450 abstract class Calculator { |
451 static const String serviceName = null; | 451 static const String serviceName = null; |
452 dynamic clear([Function responseFactory = null]); | 452 dynamic clear([Function responseFactory = null]); |
453 dynamic add(double value,[Function responseFactory = null]); | 453 dynamic add(double value,[Function responseFactory = null]); |
454 dynamic multiply(double value,[Function responseFactory = null]); | 454 dynamic multiply(double value,[Function responseFactory = null]); |
455 } | 455 } |
456 | 456 |
457 | 457 class _CalculatorProxyControl |
458 class _CalculatorProxyControl extends bindings.ProxyMessageHandler | 458 extends bindings.ProxyMessageHandler |
459 implements bindings.ProxyControl { | 459 implements bindings.ProxyControl { |
460 _CalculatorProxyControl.fromEndpoint( | 460 _CalculatorProxyControl.fromEndpoint( |
461 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 461 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
462 | 462 |
463 _CalculatorProxyControl.fromHandle( | 463 _CalculatorProxyControl.fromHandle( |
464 core.MojoHandle handle) : super.fromHandle(handle); | 464 core.MojoHandle handle) : super.fromHandle(handle); |
465 | 465 |
466 _CalculatorProxyControl.unbound() : super.unbound(); | 466 _CalculatorProxyControl.unbound() : super.unbound(); |
467 | 467 |
468 service_describer.ServiceDescription get serviceDescription => | 468 service_describer.ServiceDescription get serviceDescription => |
469 new _CalculatorServiceDescription(); | 469 new _CalculatorServiceDescription(); |
470 | 470 |
471 String get serviceName => Calculator.serviceName; | 471 String get serviceName => Calculator.serviceName; |
472 | 472 |
473 @override | |
474 void handleResponse(bindings.ServiceMessage message) { | 473 void handleResponse(bindings.ServiceMessage message) { |
475 switch (message.header.type) { | 474 switch (message.header.type) { |
476 case _calculatorMethodClearName: | 475 case _calculatorMethodClearName: |
477 var r = CalculatorClearResponseParams.deserialize( | 476 var r = CalculatorClearResponseParams.deserialize( |
478 message.payload); | 477 message.payload); |
479 if (!message.header.hasRequestId) { | 478 if (!message.header.hasRequestId) { |
480 proxyError("Expected a message with a valid request Id."); | 479 proxyError("Expected a message with a valid request Id."); |
481 return; | 480 return; |
482 } | 481 } |
483 Completer c = completerMap[message.header.requestId]; | 482 Completer c = completerMap[message.header.requestId]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 539 } |
541 } | 540 } |
542 | 541 |
543 @override | 542 @override |
544 String toString() { | 543 String toString() { |
545 var superString = super.toString(); | 544 var superString = super.toString(); |
546 return "_CalculatorProxyControl($superString)"; | 545 return "_CalculatorProxyControl($superString)"; |
547 } | 546 } |
548 } | 547 } |
549 | 548 |
550 | 549 class CalculatorProxy |
551 class CalculatorProxy extends bindings.Proxy | 550 extends bindings.Proxy |
552 implements Calculator { | 551 implements Calculator { |
553 CalculatorProxy.fromEndpoint( | 552 CalculatorProxy.fromEndpoint( |
554 core.MojoMessagePipeEndpoint endpoint) | 553 core.MojoMessagePipeEndpoint endpoint) |
555 : super(new _CalculatorProxyControl.fromEndpoint(endpoint)); | 554 : super(new _CalculatorProxyControl.fromEndpoint(endpoint)); |
556 | 555 |
557 CalculatorProxy.fromHandle(core.MojoHandle handle) | 556 CalculatorProxy.fromHandle(core.MojoHandle handle) |
558 : super(new _CalculatorProxyControl.fromHandle(handle)); | 557 : super(new _CalculatorProxyControl.fromHandle(handle)); |
559 | 558 |
560 CalculatorProxy.unbound() | 559 CalculatorProxy.unbound() |
561 : super(new _CalculatorProxyControl.unbound()); | 560 : super(new _CalculatorProxyControl.unbound()); |
562 | 561 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 var params = new _CalculatorMultiplyParams(); | 594 var params = new _CalculatorMultiplyParams(); |
596 params.value = value; | 595 params.value = value; |
597 return ctrl.sendMessageWithRequestId( | 596 return ctrl.sendMessageWithRequestId( |
598 params, | 597 params, |
599 _calculatorMethodMultiplyName, | 598 _calculatorMethodMultiplyName, |
600 -1, | 599 -1, |
601 bindings.MessageHeader.kMessageExpectsResponse); | 600 bindings.MessageHeader.kMessageExpectsResponse); |
602 } | 601 } |
603 } | 602 } |
604 | 603 |
605 | 604 class _CalculatorStubControl |
606 class CalculatorStub extends bindings.Stub { | 605 extends bindings.StubMessageHandler |
| 606 implements bindings.StubControl<Calculator> { |
607 Calculator _impl; | 607 Calculator _impl; |
608 | 608 |
609 CalculatorStub.fromEndpoint( | 609 _CalculatorStubControl.fromEndpoint( |
610 core.MojoMessagePipeEndpoint endpoint, [Calculator impl]) | 610 core.MojoMessagePipeEndpoint endpoint, [Calculator impl]) |
611 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 611 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
612 _impl = impl; | 612 _impl = impl; |
613 } | 613 } |
614 | 614 |
615 CalculatorStub.fromHandle( | 615 _CalculatorStubControl.fromHandle( |
616 core.MojoHandle handle, [Calculator impl]) | 616 core.MojoHandle handle, [Calculator impl]) |
617 : super.fromHandle(handle, autoBegin: impl != null) { | 617 : super.fromHandle(handle, autoBegin: impl != null) { |
618 _impl = impl; | 618 _impl = impl; |
619 } | 619 } |
620 | 620 |
621 CalculatorStub.unbound([this._impl]) : super.unbound(); | 621 _CalculatorStubControl.unbound([this._impl]) : super.unbound(); |
622 | |
623 static CalculatorStub newFromEndpoint( | |
624 core.MojoMessagePipeEndpoint endpoint) { | |
625 assert(endpoint.setDescription("For CalculatorStub")); | |
626 return new CalculatorStub.fromEndpoint(endpoint); | |
627 } | |
628 | 622 |
629 | 623 |
630 CalculatorClearResponseParams _calculatorClearResponseParamsFactory(double val
ue) { | 624 CalculatorClearResponseParams _calculatorClearResponseParamsFactory(double val
ue) { |
631 var result = new CalculatorClearResponseParams(); | 625 var result = new CalculatorClearResponseParams(); |
632 result.value = value; | 626 result.value = value; |
633 return result; | 627 return result; |
634 } | 628 } |
635 CalculatorAddResponseParams _calculatorAddResponseParamsFactory(double value)
{ | 629 CalculatorAddResponseParams _calculatorAddResponseParamsFactory(double value)
{ |
636 var result = new CalculatorAddResponseParams(); | 630 var result = new CalculatorAddResponseParams(); |
637 result.value = value; | 631 result.value = value; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 730 } |
737 | 731 |
738 @override | 732 @override |
739 void bind(core.MojoMessagePipeEndpoint endpoint) { | 733 void bind(core.MojoMessagePipeEndpoint endpoint) { |
740 super.bind(endpoint); | 734 super.bind(endpoint); |
741 if (!isOpen && (_impl != null)) { | 735 if (!isOpen && (_impl != null)) { |
742 beginHandlingEvents(); | 736 beginHandlingEvents(); |
743 } | 737 } |
744 } | 738 } |
745 | 739 |
| 740 @override |
746 String toString() { | 741 String toString() { |
747 var superString = super.toString(); | 742 var superString = super.toString(); |
748 return "CalculatorStub($superString)"; | 743 return "_CalculatorStubControl($superString)"; |
749 } | 744 } |
750 | 745 |
751 int get version => 0; | 746 int get version => 0; |
752 | 747 |
753 static service_describer.ServiceDescription _cachedServiceDescription; | 748 static service_describer.ServiceDescription _cachedServiceDescription; |
754 static service_describer.ServiceDescription get serviceDescription { | 749 static service_describer.ServiceDescription get serviceDescription { |
755 if (_cachedServiceDescription == null) { | 750 if (_cachedServiceDescription == null) { |
756 _cachedServiceDescription = new _CalculatorServiceDescription(); | 751 _cachedServiceDescription = new _CalculatorServiceDescription(); |
757 } | 752 } |
758 return _cachedServiceDescription; | 753 return _cachedServiceDescription; |
759 } | 754 } |
760 } | 755 } |
761 | 756 |
| 757 class CalculatorStub |
| 758 extends bindings.Stub<Calculator> |
| 759 implements Calculator { |
| 760 CalculatorStub.fromEndpoint( |
| 761 core.MojoMessagePipeEndpoint endpoint, [Calculator impl]) |
| 762 : super(new _CalculatorStubControl.fromEndpoint(endpoint, impl)); |
| 763 |
| 764 CalculatorStub.fromHandle( |
| 765 core.MojoHandle handle, [Calculator impl]) |
| 766 : super(new _CalculatorStubControl.fromHandle(handle, impl)); |
| 767 |
| 768 CalculatorStub.unbound([Calculator impl]) |
| 769 : super(new _CalculatorStubControl.unbound(impl)); |
| 770 |
| 771 static CalculatorStub newFromEndpoint( |
| 772 core.MojoMessagePipeEndpoint endpoint) { |
| 773 assert(endpoint.setDescription("For CalculatorStub")); |
| 774 return new CalculatorStub.fromEndpoint(endpoint); |
| 775 } |
| 776 |
| 777 static service_describer.ServiceDescription get serviceDescription => |
| 778 _CalculatorStubControl.serviceDescription; |
| 779 |
| 780 |
| 781 dynamic clear([Function responseFactory = null]) { |
| 782 return impl.clear(responseFactory); |
| 783 } |
| 784 dynamic add(double value,[Function responseFactory = null]) { |
| 785 return impl.add(value,responseFactory); |
| 786 } |
| 787 dynamic multiply(double value,[Function responseFactory = null]) { |
| 788 return impl.multiply(value,responseFactory); |
| 789 } |
| 790 } |
| 791 |
762 | 792 |
763 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? | 793 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? |
764 _initRuntimeTypeInfo(); | 794 _initRuntimeTypeInfo(); |
765 | 795 |
766 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { | 796 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
767 return getRuntimeTypeInfo().typeMap; | 797 return getRuntimeTypeInfo().typeMap; |
768 } | 798 } |
769 | 799 |
770 var _runtimeTypeInfo; | 800 var _runtimeTypeInfo; |
771 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { | 801 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { |
772 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of | 802 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of |
773 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this | 803 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this |
774 // file. The string contains the base64 encoding of the gzip-compressed bytes. | 804 // file. The string contains the base64 encoding of the gzip-compressed bytes. |
775 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xXTY/TMBBtU5CyLR/lc8OtEpdeWO9xx
WkRWgkJIXHgsqfKm5pskBOHOEGCX8uxR/4BOGTcOtOYflDasMpIo2kcW5n3+ual9TplDKGeQsXrurqo4
n1nxnXX2DeCvR8u319M3l5cvoxodn3ymnI/5zQTqQf7i3M949zYOF+JbvXyHN0+Res/Id506uOhyr7KR
Ufl+rHK+ypRu0u4XTgfqJyoJLlMCRc+5SQQIuCMXIuIkW8pJZH4JIhM/fJDkl/x0CdhnLH0I/WZJFdhP
A3jQJKMyUyS4skTf/7kk+JUtPR8zc9j4E9T5Bj3e8b3ldwq6/ejep5nGpezHs84xpb1uypvFzxzRtMa/
RxBz/vicYR0PEN1FV6tKxsPTwDzb7wvUvY5V83U4NaxL9yuZU491I+LdIF50gL7W56eqrxn8CQTEUt2e
J4wP+c1PldjR9bY1fx8oTxnlvk5PiA/HrLoYefP/jLqVflbxU8X0sbPAHzu1XRa+37qN8RfdjU3jwCzw
mu4Szs3m85NH97zTZubf62f4vfCnbl+tOu2+tlGP8//Q9911uTHgbTxM4Re3uU8CxP+FfMzuGG+6wE2j
Vebbzs3m83NADyo6b77A/0fWlc/ZxZenql8UNXPwnxb/91KR+MG6uhXAAAA//+Vb42mYBEAAA=="; | 805 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xXTY/TMBBtU5CyLR/lc8OtEpdeWO9xx
WkRWgkJIXHgsqfKm5pskBOHOEGCX8uxR/4BOGTcOtOYflDasMpIo2kcW5n3+ual9TplDKGeQsXrurqo4
n1nxnXX2DeCvR8u319M3l5cvoxodn3ymnI/5zQTqQf7i3M949zYOF+JbvXyHN0+Res/Id506uOhyr7KR
Ufl+rHK+ypRu0u4XTgfqJyoJLlMCRc+5SQQIuCMXIuIkW8pJZH4JIhM/fJDkl/x0CdhnLH0I/WZJFdhP
A3jQJKMyUyS4skTf/7kk+JUtPR8zc9j4E9T5Bj3e8b3ldwq6/ejep5nGpezHs84xpb1uypvFzxzRtMa/
RxBz/vicYR0PEN1FV6tKxsPTwDzb7wvUvY5V83U4NaxL9yuZU491I+LdIF50gL7W56eqrxn8CQTEUt2e
J4wP+c1PldjR9bY1fx8oTxnlvk5PiA/HrLoYefP/jLqVflbxU8X0sbPAHzu1XRa+37qN8RfdjU3jwCzw
mu4Szs3m85NH97zTZubf62f4vfCnbl+tOu2+tlGP8//Q9911uTHgbTxM4Re3uU8CxP+FfMzuGG+6wE2j
Vebbzs3m83NADyo6b77A/0fWlc/ZxZenql8UNXPwnxb/91KR+MG6uhXAAAA//+Vb42mYBEAAA=="; |
776 | 806 |
777 // Deserialize RuntimeTypeInfo | 807 // Deserialize RuntimeTypeInfo |
778 var bytes = BASE64.decode(serializedRuntimeTypeInfo); | 808 var bytes = BASE64.decode(serializedRuntimeTypeInfo); |
779 var unzippedBytes = new ZLibDecoder().convert(bytes); | 809 var unzippedBytes = new ZLibDecoder().convert(bytes); |
780 var bdata = new ByteData.view(unzippedBytes.buffer); | 810 var bdata = new ByteData.view(unzippedBytes.buffer); |
781 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); | 811 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); |
782 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); | 812 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); |
783 return _runtimeTypeInfo; | 813 return _runtimeTypeInfo; |
784 } | 814 } |
OLD | NEW |