Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/native_support/process.mojom.dart

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

Powered by Google App Engine
This is Rietveld 408576698