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 process_mojom; | 4 library process_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 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; | 9 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; |
10 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; | 10 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; |
11 | 11 |
12 | 12 |
13 | 13 |
14 class _ProcessSpawnParams extends bindings.Struct { | 14 class _ProcessSpawnParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 15 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(64, 0) | 16 const bindings.StructDataHeader(64, 0) |
17 ]; | 17 ]; |
18 List<int> path = null; | 18 List<int> path = null; |
19 List<List<int>> argv = null; | 19 List<List<int>> argv = null; |
20 List<List<int>> envp = null; | 20 List<List<int>> envp = null; |
21 file_mojom.FileInterface stdinFile = null; | 21 file_mojom.FileInterface stdinFile = null; |
22 file_mojom.FileInterface stdoutFile = null; | 22 file_mojom.FileInterface stdoutFile = null; |
23 file_mojom.FileInterface stderrFile = null; | 23 file_mojom.FileInterface stderrFile = null; |
24 ProcessControllerInterfaceRequest processController = null; | 24 ProcessControllerInterfaceRequest processController = null; |
25 | 25 |
26 _ProcessSpawnParams() : super(kVersions.last.size); | 26 _ProcessSpawnParams() : super(kVersions.last.size); |
27 | 27 |
| 28 _ProcessSpawnParams.init( |
| 29 List<int> this.path, |
| 30 List<List<int>> this.argv, |
| 31 List<List<int>> this.envp, |
| 32 file_mojom.FileInterface this.stdinFile, |
| 33 file_mojom.FileInterface this.stdoutFile, |
| 34 file_mojom.FileInterface this.stderrFile, |
| 35 ProcessControllerInterfaceRequest this.processController |
| 36 ) : super(kVersions.last.size); |
| 37 |
28 static _ProcessSpawnParams deserialize(bindings.Message message) { | 38 static _ProcessSpawnParams deserialize(bindings.Message message) { |
29 var decoder = new bindings.Decoder(message); | 39 var decoder = new bindings.Decoder(message); |
30 var result = decode(decoder); | 40 var result = decode(decoder); |
31 if (decoder.excessHandles != null) { | 41 if (decoder.excessHandles != null) { |
32 decoder.excessHandles.forEach((h) => h.close()); | 42 decoder.excessHandles.forEach((h) => h.close()); |
33 } | 43 } |
34 return result; | 44 return result; |
35 } | 45 } |
36 | 46 |
37 static _ProcessSpawnParams decode(bindings.Decoder decoder0) { | 47 static _ProcessSpawnParams decode(bindings.Decoder decoder0) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 205 |
196 | 206 |
197 class ProcessSpawnResponseParams extends bindings.Struct { | 207 class ProcessSpawnResponseParams extends bindings.Struct { |
198 static const List<bindings.StructDataHeader> kVersions = const [ | 208 static const List<bindings.StructDataHeader> kVersions = const [ |
199 const bindings.StructDataHeader(16, 0) | 209 const bindings.StructDataHeader(16, 0) |
200 ]; | 210 ]; |
201 types_mojom.Error error = null; | 211 types_mojom.Error error = null; |
202 | 212 |
203 ProcessSpawnResponseParams() : super(kVersions.last.size); | 213 ProcessSpawnResponseParams() : super(kVersions.last.size); |
204 | 214 |
| 215 ProcessSpawnResponseParams.init( |
| 216 types_mojom.Error this.error |
| 217 ) : super(kVersions.last.size); |
| 218 |
205 static ProcessSpawnResponseParams deserialize(bindings.Message message) { | 219 static ProcessSpawnResponseParams deserialize(bindings.Message message) { |
206 var decoder = new bindings.Decoder(message); | 220 var decoder = new bindings.Decoder(message); |
207 var result = decode(decoder); | 221 var result = decode(decoder); |
208 if (decoder.excessHandles != null) { | 222 if (decoder.excessHandles != null) { |
209 decoder.excessHandles.forEach((h) => h.close()); | 223 decoder.excessHandles.forEach((h) => h.close()); |
210 } | 224 } |
211 return result; | 225 return result; |
212 } | 226 } |
213 | 227 |
214 static ProcessSpawnResponseParams decode(bindings.Decoder decoder0) { | 228 static ProcessSpawnResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 const bindings.StructDataHeader(48, 0) | 289 const bindings.StructDataHeader(48, 0) |
276 ]; | 290 ]; |
277 List<int> path = null; | 291 List<int> path = null; |
278 List<List<int>> argv = null; | 292 List<List<int>> argv = null; |
279 List<List<int>> envp = null; | 293 List<List<int>> envp = null; |
280 file_mojom.FileInterface terminalFile = null; | 294 file_mojom.FileInterface terminalFile = null; |
281 ProcessControllerInterfaceRequest processController = null; | 295 ProcessControllerInterfaceRequest processController = null; |
282 | 296 |
283 _ProcessSpawnWithTerminalParams() : super(kVersions.last.size); | 297 _ProcessSpawnWithTerminalParams() : super(kVersions.last.size); |
284 | 298 |
| 299 _ProcessSpawnWithTerminalParams.init( |
| 300 List<int> this.path, |
| 301 List<List<int>> this.argv, |
| 302 List<List<int>> this.envp, |
| 303 file_mojom.FileInterface this.terminalFile, |
| 304 ProcessControllerInterfaceRequest this.processController |
| 305 ) : super(kVersions.last.size); |
| 306 |
285 static _ProcessSpawnWithTerminalParams deserialize(bindings.Message message) { | 307 static _ProcessSpawnWithTerminalParams deserialize(bindings.Message message) { |
286 var decoder = new bindings.Decoder(message); | 308 var decoder = new bindings.Decoder(message); |
287 var result = decode(decoder); | 309 var result = decode(decoder); |
288 if (decoder.excessHandles != null) { | 310 if (decoder.excessHandles != null) { |
289 decoder.excessHandles.forEach((h) => h.close()); | 311 decoder.excessHandles.forEach((h) => h.close()); |
290 } | 312 } |
291 return result; | 313 return result; |
292 } | 314 } |
293 | 315 |
294 static _ProcessSpawnWithTerminalParams decode(bindings.Decoder decoder0) { | 316 static _ProcessSpawnWithTerminalParams decode(bindings.Decoder decoder0) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 450 |
429 | 451 |
430 class ProcessSpawnWithTerminalResponseParams extends bindings.Struct { | 452 class ProcessSpawnWithTerminalResponseParams extends bindings.Struct { |
431 static const List<bindings.StructDataHeader> kVersions = const [ | 453 static const List<bindings.StructDataHeader> kVersions = const [ |
432 const bindings.StructDataHeader(16, 0) | 454 const bindings.StructDataHeader(16, 0) |
433 ]; | 455 ]; |
434 types_mojom.Error error = null; | 456 types_mojom.Error error = null; |
435 | 457 |
436 ProcessSpawnWithTerminalResponseParams() : super(kVersions.last.size); | 458 ProcessSpawnWithTerminalResponseParams() : super(kVersions.last.size); |
437 | 459 |
| 460 ProcessSpawnWithTerminalResponseParams.init( |
| 461 types_mojom.Error this.error |
| 462 ) : super(kVersions.last.size); |
| 463 |
438 static ProcessSpawnWithTerminalResponseParams deserialize(bindings.Message mes
sage) { | 464 static ProcessSpawnWithTerminalResponseParams deserialize(bindings.Message mes
sage) { |
439 var decoder = new bindings.Decoder(message); | 465 var decoder = new bindings.Decoder(message); |
440 var result = decode(decoder); | 466 var result = decode(decoder); |
441 if (decoder.excessHandles != null) { | 467 if (decoder.excessHandles != null) { |
442 decoder.excessHandles.forEach((h) => h.close()); | 468 decoder.excessHandles.forEach((h) => h.close()); |
443 } | 469 } |
444 return result; | 470 return result; |
445 } | 471 } |
446 | 472 |
447 static ProcessSpawnWithTerminalResponseParams decode(bindings.Decoder decoder0
) { | 473 static ProcessSpawnWithTerminalResponseParams decode(bindings.Decoder decoder0
) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 529 } |
504 | 530 |
505 | 531 |
506 class _ProcessControllerWaitParams extends bindings.Struct { | 532 class _ProcessControllerWaitParams extends bindings.Struct { |
507 static const List<bindings.StructDataHeader> kVersions = const [ | 533 static const List<bindings.StructDataHeader> kVersions = const [ |
508 const bindings.StructDataHeader(8, 0) | 534 const bindings.StructDataHeader(8, 0) |
509 ]; | 535 ]; |
510 | 536 |
511 _ProcessControllerWaitParams() : super(kVersions.last.size); | 537 _ProcessControllerWaitParams() : super(kVersions.last.size); |
512 | 538 |
| 539 _ProcessControllerWaitParams.init( |
| 540 ) : super(kVersions.last.size); |
| 541 |
513 static _ProcessControllerWaitParams deserialize(bindings.Message message) { | 542 static _ProcessControllerWaitParams deserialize(bindings.Message message) { |
514 var decoder = new bindings.Decoder(message); | 543 var decoder = new bindings.Decoder(message); |
515 var result = decode(decoder); | 544 var result = decode(decoder); |
516 if (decoder.excessHandles != null) { | 545 if (decoder.excessHandles != null) { |
517 decoder.excessHandles.forEach((h) => h.close()); | 546 decoder.excessHandles.forEach((h) => h.close()); |
518 } | 547 } |
519 return result; | 548 return result; |
520 } | 549 } |
521 | 550 |
522 static _ProcessControllerWaitParams decode(bindings.Decoder decoder0) { | 551 static _ProcessControllerWaitParams decode(bindings.Decoder decoder0) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 592 |
564 class ProcessControllerWaitResponseParams extends bindings.Struct { | 593 class ProcessControllerWaitResponseParams extends bindings.Struct { |
565 static const List<bindings.StructDataHeader> kVersions = const [ | 594 static const List<bindings.StructDataHeader> kVersions = const [ |
566 const bindings.StructDataHeader(16, 0) | 595 const bindings.StructDataHeader(16, 0) |
567 ]; | 596 ]; |
568 types_mojom.Error error = null; | 597 types_mojom.Error error = null; |
569 int exitStatus = 0; | 598 int exitStatus = 0; |
570 | 599 |
571 ProcessControllerWaitResponseParams() : super(kVersions.last.size); | 600 ProcessControllerWaitResponseParams() : super(kVersions.last.size); |
572 | 601 |
| 602 ProcessControllerWaitResponseParams.init( |
| 603 types_mojom.Error this.error, |
| 604 int this.exitStatus |
| 605 ) : super(kVersions.last.size); |
| 606 |
573 static ProcessControllerWaitResponseParams deserialize(bindings.Message messag
e) { | 607 static ProcessControllerWaitResponseParams deserialize(bindings.Message messag
e) { |
574 var decoder = new bindings.Decoder(message); | 608 var decoder = new bindings.Decoder(message); |
575 var result = decode(decoder); | 609 var result = decode(decoder); |
576 if (decoder.excessHandles != null) { | 610 if (decoder.excessHandles != null) { |
577 decoder.excessHandles.forEach((h) => h.close()); | 611 decoder.excessHandles.forEach((h) => h.close()); |
578 } | 612 } |
579 return result; | 613 return result; |
580 } | 614 } |
581 | 615 |
582 static ProcessControllerWaitResponseParams decode(bindings.Decoder decoder0) { | 616 static ProcessControllerWaitResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 686 |
653 | 687 |
654 class _ProcessControllerKillParams extends bindings.Struct { | 688 class _ProcessControllerKillParams extends bindings.Struct { |
655 static const List<bindings.StructDataHeader> kVersions = const [ | 689 static const List<bindings.StructDataHeader> kVersions = const [ |
656 const bindings.StructDataHeader(16, 0) | 690 const bindings.StructDataHeader(16, 0) |
657 ]; | 691 ]; |
658 int signal = 0; | 692 int signal = 0; |
659 | 693 |
660 _ProcessControllerKillParams() : super(kVersions.last.size); | 694 _ProcessControllerKillParams() : super(kVersions.last.size); |
661 | 695 |
| 696 _ProcessControllerKillParams.init( |
| 697 int this.signal |
| 698 ) : super(kVersions.last.size); |
| 699 |
662 static _ProcessControllerKillParams deserialize(bindings.Message message) { | 700 static _ProcessControllerKillParams deserialize(bindings.Message message) { |
663 var decoder = new bindings.Decoder(message); | 701 var decoder = new bindings.Decoder(message); |
664 var result = decode(decoder); | 702 var result = decode(decoder); |
665 if (decoder.excessHandles != null) { | 703 if (decoder.excessHandles != null) { |
666 decoder.excessHandles.forEach((h) => h.close()); | 704 decoder.excessHandles.forEach((h) => h.close()); |
667 } | 705 } |
668 return result; | 706 return result; |
669 } | 707 } |
670 | 708 |
671 static _ProcessControllerKillParams decode(bindings.Decoder decoder0) { | 709 static _ProcessControllerKillParams decode(bindings.Decoder decoder0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 762 |
725 | 763 |
726 class ProcessControllerKillResponseParams extends bindings.Struct { | 764 class ProcessControllerKillResponseParams extends bindings.Struct { |
727 static const List<bindings.StructDataHeader> kVersions = const [ | 765 static const List<bindings.StructDataHeader> kVersions = const [ |
728 const bindings.StructDataHeader(16, 0) | 766 const bindings.StructDataHeader(16, 0) |
729 ]; | 767 ]; |
730 types_mojom.Error error = null; | 768 types_mojom.Error error = null; |
731 | 769 |
732 ProcessControllerKillResponseParams() : super(kVersions.last.size); | 770 ProcessControllerKillResponseParams() : super(kVersions.last.size); |
733 | 771 |
| 772 ProcessControllerKillResponseParams.init( |
| 773 types_mojom.Error this.error |
| 774 ) : super(kVersions.last.size); |
| 775 |
734 static ProcessControllerKillResponseParams deserialize(bindings.Message messag
e) { | 776 static ProcessControllerKillResponseParams deserialize(bindings.Message messag
e) { |
735 var decoder = new bindings.Decoder(message); | 777 var decoder = new bindings.Decoder(message); |
736 var result = decode(decoder); | 778 var result = decode(decoder); |
737 if (decoder.excessHandles != null) { | 779 if (decoder.excessHandles != null) { |
738 decoder.excessHandles.forEach((h) => h.close()); | 780 decoder.excessHandles.forEach((h) => h.close()); |
739 } | 781 } |
740 return result; | 782 return result; |
741 } | 783 } |
742 | 784 |
743 static ProcessControllerKillResponseParams decode(bindings.Decoder decoder0) { | 785 static ProcessControllerKillResponseParams decode(bindings.Decoder decoder0) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 Map map = new Map(); | 837 Map map = new Map(); |
796 map["error"] = error; | 838 map["error"] = error; |
797 return map; | 839 return map; |
798 } | 840 } |
799 } | 841 } |
800 | 842 |
801 const int _processMethodSpawnName = 0; | 843 const int _processMethodSpawnName = 0; |
802 const int _processMethodSpawnWithTerminalName = 1; | 844 const int _processMethodSpawnWithTerminalName = 1; |
803 | 845 |
804 class _ProcessServiceDescription implements service_describer.ServiceDescription
{ | 846 class _ProcessServiceDescription implements service_describer.ServiceDescription
{ |
805 dynamic getTopLevelInterface([Function responseFactory]) => | 847 void getTopLevelInterface(Function responder) { |
806 responseFactory(null); | 848 responder(null); |
| 849 } |
807 | 850 |
808 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 851 void getTypeDefinition(String typeKey, Function responder) { |
809 responseFactory(null); | 852 responder(null); |
| 853 } |
810 | 854 |
811 dynamic getAllTypeDefinitions([Function responseFactory]) => | 855 void getAllTypeDefinitions(Function responder) { |
812 responseFactory(null); | 856 responder(null); |
| 857 } |
813 } | 858 } |
814 | 859 |
815 abstract class Process { | 860 abstract class Process { |
816 static const String serviceName = "native_support::Process"; | 861 static const String serviceName = "native_support::Process"; |
817 | 862 |
818 static service_describer.ServiceDescription _cachedServiceDescription; | 863 static service_describer.ServiceDescription _cachedServiceDescription; |
819 static service_describer.ServiceDescription get serviceDescription { | 864 static service_describer.ServiceDescription get serviceDescription { |
820 if (_cachedServiceDescription == null) { | 865 if (_cachedServiceDescription == null) { |
821 _cachedServiceDescription = new _ProcessServiceDescription(); | 866 _cachedServiceDescription = new _ProcessServiceDescription(); |
822 } | 867 } |
823 return _cachedServiceDescription; | 868 return _cachedServiceDescription; |
824 } | 869 } |
825 | 870 |
826 static ProcessProxy connectToService( | 871 static ProcessProxy connectToService( |
827 bindings.ServiceConnector s, String url, [String serviceName]) { | 872 bindings.ServiceConnector s, String url, [String serviceName]) { |
828 ProcessProxy p = new ProcessProxy.unbound(); | 873 ProcessProxy p = new ProcessProxy.unbound(); |
829 String name = serviceName ?? Process.serviceName; | 874 String name = serviceName ?? Process.serviceName; |
830 if ((name == null) || name.isEmpty) { | 875 if ((name == null) || name.isEmpty) { |
831 throw new core.MojoApiError( | 876 throw new core.MojoApiError( |
832 "If an interface has no ServiceName, then one must be provided."); | 877 "If an interface has no ServiceName, then one must be provided."); |
833 } | 878 } |
834 s.connectToService(url, p, name); | 879 s.connectToService(url, p, name); |
835 return p; | 880 return p; |
836 } | 881 } |
837 dynamic spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mo
jom.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileI
nterface stderrFile,ProcessControllerInterfaceRequest processController,[Functio
n responseFactory = null]); | 882 void spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mojom
.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileInte
rface stderrFile,ProcessControllerInterfaceRequest processController,void callba
ck(types_mojom.Error error)); |
838 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest pro
cessController,[Function responseFactory = null]); | 883 void spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>> env
p,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest proces
sController,void callback(types_mojom.Error error)); |
839 } | 884 } |
840 | 885 |
841 abstract class ProcessInterface | 886 abstract class ProcessInterface |
842 implements bindings.MojoInterface<Process>, | 887 implements bindings.MojoInterface<Process>, |
843 Process { | 888 Process { |
844 factory ProcessInterface([Process impl]) => | 889 factory ProcessInterface([Process impl]) => |
845 new ProcessStub.unbound(impl); | 890 new ProcessStub.unbound(impl); |
846 | 891 |
847 factory ProcessInterface.fromEndpoint( | 892 factory ProcessInterface.fromEndpoint( |
848 core.MojoMessagePipeEndpoint endpoint, | 893 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
878 | 923 |
879 void handleResponse(bindings.ServiceMessage message) { | 924 void handleResponse(bindings.ServiceMessage message) { |
880 switch (message.header.type) { | 925 switch (message.header.type) { |
881 case _processMethodSpawnName: | 926 case _processMethodSpawnName: |
882 var r = ProcessSpawnResponseParams.deserialize( | 927 var r = ProcessSpawnResponseParams.deserialize( |
883 message.payload); | 928 message.payload); |
884 if (!message.header.hasRequestId) { | 929 if (!message.header.hasRequestId) { |
885 proxyError("Expected a message with a valid request Id."); | 930 proxyError("Expected a message with a valid request Id."); |
886 return; | 931 return; |
887 } | 932 } |
888 Completer c = completerMap[message.header.requestId]; | 933 Function callback = callbackMap[message.header.requestId]; |
889 if (c == null) { | 934 if (callback == null) { |
890 proxyError( | 935 proxyError( |
891 "Message had unknown request Id: ${message.header.requestId}"); | 936 "Message had unknown request Id: ${message.header.requestId}"); |
892 return; | 937 return; |
893 } | 938 } |
894 completerMap.remove(message.header.requestId); | 939 callbackMap.remove(message.header.requestId); |
895 if (c.isCompleted) { | 940 callback(r.error ); |
896 proxyError("Response completer already completed"); | |
897 return; | |
898 } | |
899 c.complete(r); | |
900 break; | 941 break; |
901 case _processMethodSpawnWithTerminalName: | 942 case _processMethodSpawnWithTerminalName: |
902 var r = ProcessSpawnWithTerminalResponseParams.deserialize( | 943 var r = ProcessSpawnWithTerminalResponseParams.deserialize( |
903 message.payload); | 944 message.payload); |
904 if (!message.header.hasRequestId) { | 945 if (!message.header.hasRequestId) { |
905 proxyError("Expected a message with a valid request Id."); | 946 proxyError("Expected a message with a valid request Id."); |
906 return; | 947 return; |
907 } | 948 } |
908 Completer c = completerMap[message.header.requestId]; | 949 Function callback = callbackMap[message.header.requestId]; |
909 if (c == null) { | 950 if (callback == null) { |
910 proxyError( | 951 proxyError( |
911 "Message had unknown request Id: ${message.header.requestId}"); | 952 "Message had unknown request Id: ${message.header.requestId}"); |
912 return; | 953 return; |
913 } | 954 } |
914 completerMap.remove(message.header.requestId); | 955 callbackMap.remove(message.header.requestId); |
915 if (c.isCompleted) { | 956 callback(r.error ); |
916 proxyError("Response completer already completed"); | |
917 return; | |
918 } | |
919 c.complete(r); | |
920 break; | 957 break; |
921 default: | 958 default: |
922 proxyError("Unexpected message type: ${message.header.type}"); | 959 proxyError("Unexpected message type: ${message.header.type}"); |
923 close(immediate: true); | 960 close(immediate: true); |
924 break; | 961 break; |
925 } | 962 } |
926 } | 963 } |
927 | 964 |
928 @override | 965 @override |
929 String toString() { | 966 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
954 return newMockedProxy; | 991 return newMockedProxy; |
955 } | 992 } |
956 | 993 |
957 static ProcessProxy newFromEndpoint( | 994 static ProcessProxy newFromEndpoint( |
958 core.MojoMessagePipeEndpoint endpoint) { | 995 core.MojoMessagePipeEndpoint endpoint) { |
959 assert(endpoint.setDescription("For ProcessProxy")); | 996 assert(endpoint.setDescription("For ProcessProxy")); |
960 return new ProcessProxy.fromEndpoint(endpoint); | 997 return new ProcessProxy.fromEndpoint(endpoint); |
961 } | 998 } |
962 | 999 |
963 | 1000 |
964 dynamic spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mo
jom.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileI
nterface stderrFile,ProcessControllerInterfaceRequest processController,[Functio
n responseFactory = null]) { | 1001 void spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mojom
.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileInte
rface stderrFile,ProcessControllerInterfaceRequest processController,void callba
ck(types_mojom.Error error)) { |
965 if (impl != null) { | 1002 if (impl != null) { |
966 return new Future(() => impl.spawn(path,argv,envp,stdinFile,stdoutFile,std
errFile,processController,_ProcessStubControl._processSpawnResponseParamsFactory
)); | 1003 impl.spawn(path,argv,envp,stdinFile,stdoutFile,stderrFile,processControlle
r,callback); |
| 1004 return; |
967 } | 1005 } |
968 var params = new _ProcessSpawnParams(); | 1006 var params = new _ProcessSpawnParams(); |
969 params.path = path; | 1007 params.path = path; |
970 params.argv = argv; | 1008 params.argv = argv; |
971 params.envp = envp; | 1009 params.envp = envp; |
972 params.stdinFile = stdinFile; | 1010 params.stdinFile = stdinFile; |
973 params.stdoutFile = stdoutFile; | 1011 params.stdoutFile = stdoutFile; |
974 params.stderrFile = stderrFile; | 1012 params.stderrFile = stderrFile; |
975 params.processController = processController; | 1013 params.processController = processController; |
976 return ctrl.sendMessageWithRequestId( | 1014 ctrl.sendMessageWithRequestId( |
977 params, | 1015 params, |
978 _processMethodSpawnName, | 1016 _processMethodSpawnName, |
979 -1, | 1017 -1, |
980 bindings.MessageHeader.kMessageExpectsResponse); | 1018 bindings.MessageHeader.kMessageExpectsResponse, |
| 1019 callback); |
981 } | 1020 } |
982 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest pro
cessController,[Function responseFactory = null]) { | 1021 void spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>> env
p,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest proces
sController,void callback(types_mojom.Error error)) { |
983 if (impl != null) { | 1022 if (impl != null) { |
984 return new Future(() => impl.spawnWithTerminal(path,argv,envp,terminalFile
,processController,_ProcessStubControl._processSpawnWithTerminalResponseParamsFa
ctory)); | 1023 impl.spawnWithTerminal(path,argv,envp,terminalFile,processController,callb
ack); |
| 1024 return; |
985 } | 1025 } |
986 var params = new _ProcessSpawnWithTerminalParams(); | 1026 var params = new _ProcessSpawnWithTerminalParams(); |
987 params.path = path; | 1027 params.path = path; |
988 params.argv = argv; | 1028 params.argv = argv; |
989 params.envp = envp; | 1029 params.envp = envp; |
990 params.terminalFile = terminalFile; | 1030 params.terminalFile = terminalFile; |
991 params.processController = processController; | 1031 params.processController = processController; |
992 return ctrl.sendMessageWithRequestId( | 1032 ctrl.sendMessageWithRequestId( |
993 params, | 1033 params, |
994 _processMethodSpawnWithTerminalName, | 1034 _processMethodSpawnWithTerminalName, |
995 -1, | 1035 -1, |
996 bindings.MessageHeader.kMessageExpectsResponse); | 1036 bindings.MessageHeader.kMessageExpectsResponse, |
| 1037 callback); |
997 } | 1038 } |
998 } | 1039 } |
999 | 1040 |
1000 class _ProcessStubControl | 1041 class _ProcessStubControl |
1001 extends bindings.StubMessageHandler | 1042 extends bindings.StubMessageHandler |
1002 implements bindings.StubControl<Process> { | 1043 implements bindings.StubControl<Process> { |
1003 Process _impl; | 1044 Process _impl; |
1004 | 1045 |
1005 _ProcessStubControl.fromEndpoint( | 1046 _ProcessStubControl.fromEndpoint( |
1006 core.MojoMessagePipeEndpoint endpoint, [Process impl]) | 1047 core.MojoMessagePipeEndpoint endpoint, [Process impl]) |
1007 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 1048 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
1008 _impl = impl; | 1049 _impl = impl; |
1009 } | 1050 } |
1010 | 1051 |
1011 _ProcessStubControl.fromHandle( | 1052 _ProcessStubControl.fromHandle( |
1012 core.MojoHandle handle, [Process impl]) | 1053 core.MojoHandle handle, [Process impl]) |
1013 : super.fromHandle(handle, autoBegin: impl != null) { | 1054 : super.fromHandle(handle, autoBegin: impl != null) { |
1014 _impl = impl; | 1055 _impl = impl; |
1015 } | 1056 } |
1016 | 1057 |
1017 _ProcessStubControl.unbound([this._impl]) : super.unbound(); | 1058 _ProcessStubControl.unbound([this._impl]) : super.unbound(); |
1018 | 1059 |
1019 String get serviceName => Process.serviceName; | 1060 String get serviceName => Process.serviceName; |
1020 | 1061 |
1021 | 1062 |
1022 static ProcessSpawnResponseParams _processSpawnResponseParamsFactory(types_moj
om.Error error) { | 1063 Function _processSpawnResponseParamsResponder( |
1023 var result = new ProcessSpawnResponseParams(); | 1064 int requestId) { |
1024 result.error = error; | 1065 return (types_mojom.Error error) { |
1025 return result; | 1066 var result = new ProcessSpawnResponseParams(); |
| 1067 result.error = error; |
| 1068 sendResponse(buildResponseWithId( |
| 1069 result, |
| 1070 _processMethodSpawnName, |
| 1071 requestId, |
| 1072 bindings.MessageHeader.kMessageIsResponse)); |
| 1073 }; |
1026 } | 1074 } |
1027 static ProcessSpawnWithTerminalResponseParams _processSpawnWithTerminalRespons
eParamsFactory(types_mojom.Error error) { | 1075 Function _processSpawnWithTerminalResponseParamsResponder( |
1028 var result = new ProcessSpawnWithTerminalResponseParams(); | 1076 int requestId) { |
1029 result.error = error; | 1077 return (types_mojom.Error error) { |
1030 return result; | 1078 var result = new ProcessSpawnWithTerminalResponseParams(); |
| 1079 result.error = error; |
| 1080 sendResponse(buildResponseWithId( |
| 1081 result, |
| 1082 _processMethodSpawnWithTerminalName, |
| 1083 requestId, |
| 1084 bindings.MessageHeader.kMessageIsResponse)); |
| 1085 }; |
1031 } | 1086 } |
1032 | 1087 |
1033 dynamic handleMessage(bindings.ServiceMessage message) { | 1088 void handleMessage(bindings.ServiceMessage message) { |
1034 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1089 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
1035 return bindings.ControlMessageHandler.handleMessage(this, | 1090 bindings.ControlMessageHandler.handleMessage( |
1036 0, | 1091 this, 0, message); |
1037 message); | 1092 return; |
1038 } | 1093 } |
1039 if (_impl == null) { | 1094 if (_impl == null) { |
1040 throw new core.MojoApiError("$this has no implementation set"); | 1095 throw new core.MojoApiError("$this has no implementation set"); |
1041 } | 1096 } |
1042 switch (message.header.type) { | 1097 switch (message.header.type) { |
1043 case _processMethodSpawnName: | 1098 case _processMethodSpawnName: |
1044 var params = _ProcessSpawnParams.deserialize( | 1099 var params = _ProcessSpawnParams.deserialize( |
1045 message.payload); | 1100 message.payload); |
1046 var response = _impl.spawn(params.path,params.argv,params.envp,params.st
dinFile,params.stdoutFile,params.stderrFile,params.processController,_processSpa
wnResponseParamsFactory); | 1101 _impl.spawn(params.path, params.argv, params.envp, params.stdinFile, par
ams.stdoutFile, params.stderrFile, params.processController, _processSpawnRespon
seParamsResponder(message.header.requestId)); |
1047 if (response is Future) { | |
1048 return response.then((response) { | |
1049 if (response != null) { | |
1050 return buildResponseWithId( | |
1051 response, | |
1052 _processMethodSpawnName, | |
1053 message.header.requestId, | |
1054 bindings.MessageHeader.kMessageIsResponse); | |
1055 } | |
1056 }); | |
1057 } else if (response != null) { | |
1058 return buildResponseWithId( | |
1059 response, | |
1060 _processMethodSpawnName, | |
1061 message.header.requestId, | |
1062 bindings.MessageHeader.kMessageIsResponse); | |
1063 } | |
1064 break; | 1102 break; |
1065 case _processMethodSpawnWithTerminalName: | 1103 case _processMethodSpawnWithTerminalName: |
1066 var params = _ProcessSpawnWithTerminalParams.deserialize( | 1104 var params = _ProcessSpawnWithTerminalParams.deserialize( |
1067 message.payload); | 1105 message.payload); |
1068 var response = _impl.spawnWithTerminal(params.path,params.argv,params.en
vp,params.terminalFile,params.processController,_processSpawnWithTerminalRespons
eParamsFactory); | 1106 _impl.spawnWithTerminal(params.path, params.argv, params.envp, params.te
rminalFile, params.processController, _processSpawnWithTerminalResponseParamsRes
ponder(message.header.requestId)); |
1069 if (response is Future) { | |
1070 return response.then((response) { | |
1071 if (response != null) { | |
1072 return buildResponseWithId( | |
1073 response, | |
1074 _processMethodSpawnWithTerminalName, | |
1075 message.header.requestId, | |
1076 bindings.MessageHeader.kMessageIsResponse); | |
1077 } | |
1078 }); | |
1079 } else if (response != null) { | |
1080 return buildResponseWithId( | |
1081 response, | |
1082 _processMethodSpawnWithTerminalName, | |
1083 message.header.requestId, | |
1084 bindings.MessageHeader.kMessageIsResponse); | |
1085 } | |
1086 break; | 1107 break; |
1087 default: | 1108 default: |
1088 throw new bindings.MojoCodecError("Unexpected message name"); | 1109 throw new bindings.MojoCodecError("Unexpected message name"); |
1089 break; | 1110 break; |
1090 } | 1111 } |
1091 return null; | |
1092 } | 1112 } |
1093 | 1113 |
1094 Process get impl => _impl; | 1114 Process get impl => _impl; |
1095 set impl(Process d) { | 1115 set impl(Process d) { |
1096 if (d == null) { | 1116 if (d == null) { |
1097 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 1117 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
1098 } | 1118 } |
1099 if (isBound && (_impl == null)) { | 1119 if (isBound && (_impl == null)) { |
1100 beginHandlingEvents(); | 1120 beginHandlingEvents(); |
1101 } | 1121 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 core.MojoHandle handle, [Process impl]) | 1155 core.MojoHandle handle, [Process impl]) |
1136 : super(new _ProcessStubControl.fromHandle(handle, impl)); | 1156 : super(new _ProcessStubControl.fromHandle(handle, impl)); |
1137 | 1157 |
1138 static ProcessStub newFromEndpoint( | 1158 static ProcessStub newFromEndpoint( |
1139 core.MojoMessagePipeEndpoint endpoint) { | 1159 core.MojoMessagePipeEndpoint endpoint) { |
1140 assert(endpoint.setDescription("For ProcessStub")); | 1160 assert(endpoint.setDescription("For ProcessStub")); |
1141 return new ProcessStub.fromEndpoint(endpoint); | 1161 return new ProcessStub.fromEndpoint(endpoint); |
1142 } | 1162 } |
1143 | 1163 |
1144 | 1164 |
1145 dynamic spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mo
jom.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileI
nterface stderrFile,ProcessControllerInterfaceRequest processController,[Functio
n responseFactory = null]) { | 1165 void spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,file_mojom
.FileInterface stdinFile,file_mojom.FileInterface stdoutFile,file_mojom.FileInte
rface stderrFile,ProcessControllerInterfaceRequest processController,void callba
ck(types_mojom.Error error)) { |
1146 return impl.spawn(path,argv,envp,stdinFile,stdoutFile,stderrFile,processCont
roller,responseFactory); | 1166 return impl.spawn(path,argv,envp,stdinFile,stdoutFile,stderrFile,processCont
roller,callback); |
1147 } | 1167 } |
1148 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest pro
cessController,[Function responseFactory = null]) { | 1168 void spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>> env
p,file_mojom.FileInterface terminalFile,ProcessControllerInterfaceRequest proces
sController,void callback(types_mojom.Error error)) { |
1149 return impl.spawnWithTerminal(path,argv,envp,terminalFile,processController,
responseFactory); | 1169 return impl.spawnWithTerminal(path,argv,envp,terminalFile,processController,
callback); |
1150 } | 1170 } |
1151 } | 1171 } |
1152 | 1172 |
1153 const int _processControllerMethodWaitName = 0; | 1173 const int _processControllerMethodWaitName = 0; |
1154 const int _processControllerMethodKillName = 1; | 1174 const int _processControllerMethodKillName = 1; |
1155 | 1175 |
1156 class _ProcessControllerServiceDescription implements service_describer.ServiceD
escription { | 1176 class _ProcessControllerServiceDescription implements service_describer.ServiceD
escription { |
1157 dynamic getTopLevelInterface([Function responseFactory]) => | 1177 void getTopLevelInterface(Function responder) { |
1158 responseFactory(null); | 1178 responder(null); |
| 1179 } |
1159 | 1180 |
1160 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 1181 void getTypeDefinition(String typeKey, Function responder) { |
1161 responseFactory(null); | 1182 responder(null); |
| 1183 } |
1162 | 1184 |
1163 dynamic getAllTypeDefinitions([Function responseFactory]) => | 1185 void getAllTypeDefinitions(Function responder) { |
1164 responseFactory(null); | 1186 responder(null); |
| 1187 } |
1165 } | 1188 } |
1166 | 1189 |
1167 abstract class ProcessController { | 1190 abstract class ProcessController { |
1168 static const String serviceName = null; | 1191 static const String serviceName = null; |
1169 | 1192 |
1170 static service_describer.ServiceDescription _cachedServiceDescription; | 1193 static service_describer.ServiceDescription _cachedServiceDescription; |
1171 static service_describer.ServiceDescription get serviceDescription { | 1194 static service_describer.ServiceDescription get serviceDescription { |
1172 if (_cachedServiceDescription == null) { | 1195 if (_cachedServiceDescription == null) { |
1173 _cachedServiceDescription = new _ProcessControllerServiceDescription(); | 1196 _cachedServiceDescription = new _ProcessControllerServiceDescription(); |
1174 } | 1197 } |
1175 return _cachedServiceDescription; | 1198 return _cachedServiceDescription; |
1176 } | 1199 } |
1177 | 1200 |
1178 static ProcessControllerProxy connectToService( | 1201 static ProcessControllerProxy connectToService( |
1179 bindings.ServiceConnector s, String url, [String serviceName]) { | 1202 bindings.ServiceConnector s, String url, [String serviceName]) { |
1180 ProcessControllerProxy p = new ProcessControllerProxy.unbound(); | 1203 ProcessControllerProxy p = new ProcessControllerProxy.unbound(); |
1181 String name = serviceName ?? ProcessController.serviceName; | 1204 String name = serviceName ?? ProcessController.serviceName; |
1182 if ((name == null) || name.isEmpty) { | 1205 if ((name == null) || name.isEmpty) { |
1183 throw new core.MojoApiError( | 1206 throw new core.MojoApiError( |
1184 "If an interface has no ServiceName, then one must be provided."); | 1207 "If an interface has no ServiceName, then one must be provided."); |
1185 } | 1208 } |
1186 s.connectToService(url, p, name); | 1209 s.connectToService(url, p, name); |
1187 return p; | 1210 return p; |
1188 } | 1211 } |
1189 dynamic wait([Function responseFactory = null]); | 1212 void wait(void callback(types_mojom.Error error, int exitStatus)); |
1190 dynamic kill(int signal,[Function responseFactory = null]); | 1213 void kill(int signal,void callback(types_mojom.Error error)); |
1191 } | 1214 } |
1192 | 1215 |
1193 abstract class ProcessControllerInterface | 1216 abstract class ProcessControllerInterface |
1194 implements bindings.MojoInterface<ProcessController>, | 1217 implements bindings.MojoInterface<ProcessController>, |
1195 ProcessController { | 1218 ProcessController { |
1196 factory ProcessControllerInterface([ProcessController impl]) => | 1219 factory ProcessControllerInterface([ProcessController impl]) => |
1197 new ProcessControllerStub.unbound(impl); | 1220 new ProcessControllerStub.unbound(impl); |
1198 | 1221 |
1199 factory ProcessControllerInterface.fromEndpoint( | 1222 factory ProcessControllerInterface.fromEndpoint( |
1200 core.MojoMessagePipeEndpoint endpoint, | 1223 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
1230 | 1253 |
1231 void handleResponse(bindings.ServiceMessage message) { | 1254 void handleResponse(bindings.ServiceMessage message) { |
1232 switch (message.header.type) { | 1255 switch (message.header.type) { |
1233 case _processControllerMethodWaitName: | 1256 case _processControllerMethodWaitName: |
1234 var r = ProcessControllerWaitResponseParams.deserialize( | 1257 var r = ProcessControllerWaitResponseParams.deserialize( |
1235 message.payload); | 1258 message.payload); |
1236 if (!message.header.hasRequestId) { | 1259 if (!message.header.hasRequestId) { |
1237 proxyError("Expected a message with a valid request Id."); | 1260 proxyError("Expected a message with a valid request Id."); |
1238 return; | 1261 return; |
1239 } | 1262 } |
1240 Completer c = completerMap[message.header.requestId]; | 1263 Function callback = callbackMap[message.header.requestId]; |
1241 if (c == null) { | 1264 if (callback == null) { |
1242 proxyError( | 1265 proxyError( |
1243 "Message had unknown request Id: ${message.header.requestId}"); | 1266 "Message had unknown request Id: ${message.header.requestId}"); |
1244 return; | 1267 return; |
1245 } | 1268 } |
1246 completerMap.remove(message.header.requestId); | 1269 callbackMap.remove(message.header.requestId); |
1247 if (c.isCompleted) { | 1270 callback(r.error , r.exitStatus ); |
1248 proxyError("Response completer already completed"); | |
1249 return; | |
1250 } | |
1251 c.complete(r); | |
1252 break; | 1271 break; |
1253 case _processControllerMethodKillName: | 1272 case _processControllerMethodKillName: |
1254 var r = ProcessControllerKillResponseParams.deserialize( | 1273 var r = ProcessControllerKillResponseParams.deserialize( |
1255 message.payload); | 1274 message.payload); |
1256 if (!message.header.hasRequestId) { | 1275 if (!message.header.hasRequestId) { |
1257 proxyError("Expected a message with a valid request Id."); | 1276 proxyError("Expected a message with a valid request Id."); |
1258 return; | 1277 return; |
1259 } | 1278 } |
1260 Completer c = completerMap[message.header.requestId]; | 1279 Function callback = callbackMap[message.header.requestId]; |
1261 if (c == null) { | 1280 if (callback == null) { |
1262 proxyError( | 1281 proxyError( |
1263 "Message had unknown request Id: ${message.header.requestId}"); | 1282 "Message had unknown request Id: ${message.header.requestId}"); |
1264 return; | 1283 return; |
1265 } | 1284 } |
1266 completerMap.remove(message.header.requestId); | 1285 callbackMap.remove(message.header.requestId); |
1267 if (c.isCompleted) { | 1286 callback(r.error ); |
1268 proxyError("Response completer already completed"); | |
1269 return; | |
1270 } | |
1271 c.complete(r); | |
1272 break; | 1287 break; |
1273 default: | 1288 default: |
1274 proxyError("Unexpected message type: ${message.header.type}"); | 1289 proxyError("Unexpected message type: ${message.header.type}"); |
1275 close(immediate: true); | 1290 close(immediate: true); |
1276 break; | 1291 break; |
1277 } | 1292 } |
1278 } | 1293 } |
1279 | 1294 |
1280 @override | 1295 @override |
1281 String toString() { | 1296 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
1306 return newMockedProxy; | 1321 return newMockedProxy; |
1307 } | 1322 } |
1308 | 1323 |
1309 static ProcessControllerProxy newFromEndpoint( | 1324 static ProcessControllerProxy newFromEndpoint( |
1310 core.MojoMessagePipeEndpoint endpoint) { | 1325 core.MojoMessagePipeEndpoint endpoint) { |
1311 assert(endpoint.setDescription("For ProcessControllerProxy")); | 1326 assert(endpoint.setDescription("For ProcessControllerProxy")); |
1312 return new ProcessControllerProxy.fromEndpoint(endpoint); | 1327 return new ProcessControllerProxy.fromEndpoint(endpoint); |
1313 } | 1328 } |
1314 | 1329 |
1315 | 1330 |
1316 dynamic wait([Function responseFactory = null]) { | 1331 void wait(void callback(types_mojom.Error error, int exitStatus)) { |
1317 if (impl != null) { | 1332 if (impl != null) { |
1318 return new Future(() => impl.wait(_ProcessControllerStubControl._processCo
ntrollerWaitResponseParamsFactory)); | 1333 impl.wait(callback); |
| 1334 return; |
1319 } | 1335 } |
1320 var params = new _ProcessControllerWaitParams(); | 1336 var params = new _ProcessControllerWaitParams(); |
1321 return ctrl.sendMessageWithRequestId( | 1337 ctrl.sendMessageWithRequestId( |
1322 params, | 1338 params, |
1323 _processControllerMethodWaitName, | 1339 _processControllerMethodWaitName, |
1324 -1, | 1340 -1, |
1325 bindings.MessageHeader.kMessageExpectsResponse); | 1341 bindings.MessageHeader.kMessageExpectsResponse, |
| 1342 callback); |
1326 } | 1343 } |
1327 dynamic kill(int signal,[Function responseFactory = null]) { | 1344 void kill(int signal,void callback(types_mojom.Error error)) { |
1328 if (impl != null) { | 1345 if (impl != null) { |
1329 return new Future(() => impl.kill(signal,_ProcessControllerStubControl._pr
ocessControllerKillResponseParamsFactory)); | 1346 impl.kill(signal,callback); |
| 1347 return; |
1330 } | 1348 } |
1331 var params = new _ProcessControllerKillParams(); | 1349 var params = new _ProcessControllerKillParams(); |
1332 params.signal = signal; | 1350 params.signal = signal; |
1333 return ctrl.sendMessageWithRequestId( | 1351 ctrl.sendMessageWithRequestId( |
1334 params, | 1352 params, |
1335 _processControllerMethodKillName, | 1353 _processControllerMethodKillName, |
1336 -1, | 1354 -1, |
1337 bindings.MessageHeader.kMessageExpectsResponse); | 1355 bindings.MessageHeader.kMessageExpectsResponse, |
| 1356 callback); |
1338 } | 1357 } |
1339 } | 1358 } |
1340 | 1359 |
1341 class _ProcessControllerStubControl | 1360 class _ProcessControllerStubControl |
1342 extends bindings.StubMessageHandler | 1361 extends bindings.StubMessageHandler |
1343 implements bindings.StubControl<ProcessController> { | 1362 implements bindings.StubControl<ProcessController> { |
1344 ProcessController _impl; | 1363 ProcessController _impl; |
1345 | 1364 |
1346 _ProcessControllerStubControl.fromEndpoint( | 1365 _ProcessControllerStubControl.fromEndpoint( |
1347 core.MojoMessagePipeEndpoint endpoint, [ProcessController impl]) | 1366 core.MojoMessagePipeEndpoint endpoint, [ProcessController impl]) |
1348 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 1367 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
1349 _impl = impl; | 1368 _impl = impl; |
1350 } | 1369 } |
1351 | 1370 |
1352 _ProcessControllerStubControl.fromHandle( | 1371 _ProcessControllerStubControl.fromHandle( |
1353 core.MojoHandle handle, [ProcessController impl]) | 1372 core.MojoHandle handle, [ProcessController impl]) |
1354 : super.fromHandle(handle, autoBegin: impl != null) { | 1373 : super.fromHandle(handle, autoBegin: impl != null) { |
1355 _impl = impl; | 1374 _impl = impl; |
1356 } | 1375 } |
1357 | 1376 |
1358 _ProcessControllerStubControl.unbound([this._impl]) : super.unbound(); | 1377 _ProcessControllerStubControl.unbound([this._impl]) : super.unbound(); |
1359 | 1378 |
1360 String get serviceName => ProcessController.serviceName; | 1379 String get serviceName => ProcessController.serviceName; |
1361 | 1380 |
1362 | 1381 |
1363 static ProcessControllerWaitResponseParams _processControllerWaitResponseParam
sFactory(types_mojom.Error error, int exitStatus) { | 1382 Function _processControllerWaitResponseParamsResponder( |
1364 var result = new ProcessControllerWaitResponseParams(); | 1383 int requestId) { |
1365 result.error = error; | 1384 return (types_mojom.Error error, int exitStatus) { |
1366 result.exitStatus = exitStatus; | 1385 var result = new ProcessControllerWaitResponseParams(); |
1367 return result; | 1386 result.error = error; |
| 1387 result.exitStatus = exitStatus; |
| 1388 sendResponse(buildResponseWithId( |
| 1389 result, |
| 1390 _processControllerMethodWaitName, |
| 1391 requestId, |
| 1392 bindings.MessageHeader.kMessageIsResponse)); |
| 1393 }; |
1368 } | 1394 } |
1369 static ProcessControllerKillResponseParams _processControllerKillResponseParam
sFactory(types_mojom.Error error) { | 1395 Function _processControllerKillResponseParamsResponder( |
1370 var result = new ProcessControllerKillResponseParams(); | 1396 int requestId) { |
1371 result.error = error; | 1397 return (types_mojom.Error error) { |
1372 return result; | 1398 var result = new ProcessControllerKillResponseParams(); |
| 1399 result.error = error; |
| 1400 sendResponse(buildResponseWithId( |
| 1401 result, |
| 1402 _processControllerMethodKillName, |
| 1403 requestId, |
| 1404 bindings.MessageHeader.kMessageIsResponse)); |
| 1405 }; |
1373 } | 1406 } |
1374 | 1407 |
1375 dynamic handleMessage(bindings.ServiceMessage message) { | 1408 void handleMessage(bindings.ServiceMessage message) { |
1376 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1409 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
1377 return bindings.ControlMessageHandler.handleMessage(this, | 1410 bindings.ControlMessageHandler.handleMessage( |
1378 0, | 1411 this, 0, message); |
1379 message); | 1412 return; |
1380 } | 1413 } |
1381 if (_impl == null) { | 1414 if (_impl == null) { |
1382 throw new core.MojoApiError("$this has no implementation set"); | 1415 throw new core.MojoApiError("$this has no implementation set"); |
1383 } | 1416 } |
1384 switch (message.header.type) { | 1417 switch (message.header.type) { |
1385 case _processControllerMethodWaitName: | 1418 case _processControllerMethodWaitName: |
1386 var response = _impl.wait(_processControllerWaitResponseParamsFactory); | 1419 _impl.wait(_processControllerWaitResponseParamsResponder(message.header.
requestId)); |
1387 if (response is Future) { | |
1388 return response.then((response) { | |
1389 if (response != null) { | |
1390 return buildResponseWithId( | |
1391 response, | |
1392 _processControllerMethodWaitName, | |
1393 message.header.requestId, | |
1394 bindings.MessageHeader.kMessageIsResponse); | |
1395 } | |
1396 }); | |
1397 } else if (response != null) { | |
1398 return buildResponseWithId( | |
1399 response, | |
1400 _processControllerMethodWaitName, | |
1401 message.header.requestId, | |
1402 bindings.MessageHeader.kMessageIsResponse); | |
1403 } | |
1404 break; | 1420 break; |
1405 case _processControllerMethodKillName: | 1421 case _processControllerMethodKillName: |
1406 var params = _ProcessControllerKillParams.deserialize( | 1422 var params = _ProcessControllerKillParams.deserialize( |
1407 message.payload); | 1423 message.payload); |
1408 var response = _impl.kill(params.signal,_processControllerKillResponsePa
ramsFactory); | 1424 _impl.kill(params.signal, _processControllerKillResponseParamsResponder(
message.header.requestId)); |
1409 if (response is Future) { | |
1410 return response.then((response) { | |
1411 if (response != null) { | |
1412 return buildResponseWithId( | |
1413 response, | |
1414 _processControllerMethodKillName, | |
1415 message.header.requestId, | |
1416 bindings.MessageHeader.kMessageIsResponse); | |
1417 } | |
1418 }); | |
1419 } else if (response != null) { | |
1420 return buildResponseWithId( | |
1421 response, | |
1422 _processControllerMethodKillName, | |
1423 message.header.requestId, | |
1424 bindings.MessageHeader.kMessageIsResponse); | |
1425 } | |
1426 break; | 1425 break; |
1427 default: | 1426 default: |
1428 throw new bindings.MojoCodecError("Unexpected message name"); | 1427 throw new bindings.MojoCodecError("Unexpected message name"); |
1429 break; | 1428 break; |
1430 } | 1429 } |
1431 return null; | |
1432 } | 1430 } |
1433 | 1431 |
1434 ProcessController get impl => _impl; | 1432 ProcessController get impl => _impl; |
1435 set impl(ProcessController d) { | 1433 set impl(ProcessController d) { |
1436 if (d == null) { | 1434 if (d == null) { |
1437 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 1435 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
1438 } | 1436 } |
1439 if (isBound && (_impl == null)) { | 1437 if (isBound && (_impl == null)) { |
1440 beginHandlingEvents(); | 1438 beginHandlingEvents(); |
1441 } | 1439 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 core.MojoHandle handle, [ProcessController impl]) | 1473 core.MojoHandle handle, [ProcessController impl]) |
1476 : super(new _ProcessControllerStubControl.fromHandle(handle, impl)); | 1474 : super(new _ProcessControllerStubControl.fromHandle(handle, impl)); |
1477 | 1475 |
1478 static ProcessControllerStub newFromEndpoint( | 1476 static ProcessControllerStub newFromEndpoint( |
1479 core.MojoMessagePipeEndpoint endpoint) { | 1477 core.MojoMessagePipeEndpoint endpoint) { |
1480 assert(endpoint.setDescription("For ProcessControllerStub")); | 1478 assert(endpoint.setDescription("For ProcessControllerStub")); |
1481 return new ProcessControllerStub.fromEndpoint(endpoint); | 1479 return new ProcessControllerStub.fromEndpoint(endpoint); |
1482 } | 1480 } |
1483 | 1481 |
1484 | 1482 |
1485 dynamic wait([Function responseFactory = null]) { | 1483 void wait(void callback(types_mojom.Error error, int exitStatus)) { |
1486 return impl.wait(responseFactory); | 1484 return impl.wait(callback); |
1487 } | 1485 } |
1488 dynamic kill(int signal,[Function responseFactory = null]) { | 1486 void kill(int signal,void callback(types_mojom.Error error)) { |
1489 return impl.kill(signal,responseFactory); | 1487 return impl.kill(signal,callback); |
1490 } | 1488 } |
1491 } | 1489 } |
1492 | 1490 |
1493 | 1491 |
1494 | 1492 |
OLD | NEW |