OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library process_mojom; | 5 library process_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; | 13 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; |
12 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; | 14 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; |
13 | 15 |
14 | 16 |
15 | 17 |
16 class _ProcessSpawnParams extends bindings.Struct { | 18 class _ProcessSpawnParams extends bindings.Struct { |
17 static const List<bindings.StructDataHeader> kVersions = const [ | 19 static const List<bindings.StructDataHeader> kVersions = const [ |
18 const bindings.StructDataHeader(64, 0) | 20 const bindings.StructDataHeader(64, 0) |
19 ]; | 21 ]; |
20 List<int> path = null; | 22 List<int> path = null; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 "processController: $processController" ")"; | 158 "processController: $processController" ")"; |
157 } | 159 } |
158 | 160 |
159 Map toJson() { | 161 Map toJson() { |
160 throw new bindings.MojoCodecError( | 162 throw new bindings.MojoCodecError( |
161 'Object containing handles cannot be encoded to JSON.'); | 163 'Object containing handles cannot be encoded to JSON.'); |
162 } | 164 } |
163 } | 165 } |
164 | 166 |
165 | 167 |
| 168 |
| 169 |
166 class ProcessSpawnResponseParams extends bindings.Struct { | 170 class ProcessSpawnResponseParams extends bindings.Struct { |
167 static const List<bindings.StructDataHeader> kVersions = const [ | 171 static const List<bindings.StructDataHeader> kVersions = const [ |
168 const bindings.StructDataHeader(16, 0) | 172 const bindings.StructDataHeader(16, 0) |
169 ]; | 173 ]; |
170 types_mojom.Error error = null; | 174 types_mojom.Error error = null; |
171 | 175 |
172 ProcessSpawnResponseParams() : super(kVersions.last.size); | 176 ProcessSpawnResponseParams() : super(kVersions.last.size); |
173 | 177 |
174 static ProcessSpawnResponseParams deserialize(bindings.Message message) { | 178 static ProcessSpawnResponseParams deserialize(bindings.Message message) { |
175 var decoder = new bindings.Decoder(message); | 179 var decoder = new bindings.Decoder(message); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 231 } |
228 | 232 |
229 Map toJson() { | 233 Map toJson() { |
230 Map map = new Map(); | 234 Map map = new Map(); |
231 map["error"] = error; | 235 map["error"] = error; |
232 return map; | 236 return map; |
233 } | 237 } |
234 } | 238 } |
235 | 239 |
236 | 240 |
| 241 |
| 242 |
237 class _ProcessSpawnWithTerminalParams extends bindings.Struct { | 243 class _ProcessSpawnWithTerminalParams extends bindings.Struct { |
238 static const List<bindings.StructDataHeader> kVersions = const [ | 244 static const List<bindings.StructDataHeader> kVersions = const [ |
239 const bindings.StructDataHeader(48, 0) | 245 const bindings.StructDataHeader(48, 0) |
240 ]; | 246 ]; |
241 List<int> path = null; | 247 List<int> path = null; |
242 List<List<int>> argv = null; | 248 List<List<int>> argv = null; |
243 List<List<int>> envp = null; | 249 List<List<int>> envp = null; |
244 Object terminalFile = null; | 250 Object terminalFile = null; |
245 Object processController = null; | 251 Object processController = null; |
246 | 252 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 "processController: $processController" ")"; | 367 "processController: $processController" ")"; |
362 } | 368 } |
363 | 369 |
364 Map toJson() { | 370 Map toJson() { |
365 throw new bindings.MojoCodecError( | 371 throw new bindings.MojoCodecError( |
366 'Object containing handles cannot be encoded to JSON.'); | 372 'Object containing handles cannot be encoded to JSON.'); |
367 } | 373 } |
368 } | 374 } |
369 | 375 |
370 | 376 |
| 377 |
| 378 |
371 class ProcessSpawnWithTerminalResponseParams extends bindings.Struct { | 379 class ProcessSpawnWithTerminalResponseParams extends bindings.Struct { |
372 static const List<bindings.StructDataHeader> kVersions = const [ | 380 static const List<bindings.StructDataHeader> kVersions = const [ |
373 const bindings.StructDataHeader(16, 0) | 381 const bindings.StructDataHeader(16, 0) |
374 ]; | 382 ]; |
375 types_mojom.Error error = null; | 383 types_mojom.Error error = null; |
376 | 384 |
377 ProcessSpawnWithTerminalResponseParams() : super(kVersions.last.size); | 385 ProcessSpawnWithTerminalResponseParams() : super(kVersions.last.size); |
378 | 386 |
379 static ProcessSpawnWithTerminalResponseParams deserialize(bindings.Message mes
sage) { | 387 static ProcessSpawnWithTerminalResponseParams deserialize(bindings.Message mes
sage) { |
380 var decoder = new bindings.Decoder(message); | 388 var decoder = new bindings.Decoder(message); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 } | 440 } |
433 | 441 |
434 Map toJson() { | 442 Map toJson() { |
435 Map map = new Map(); | 443 Map map = new Map(); |
436 map["error"] = error; | 444 map["error"] = error; |
437 return map; | 445 return map; |
438 } | 446 } |
439 } | 447 } |
440 | 448 |
441 | 449 |
| 450 |
| 451 |
442 class _ProcessControllerWaitParams extends bindings.Struct { | 452 class _ProcessControllerWaitParams extends bindings.Struct { |
443 static const List<bindings.StructDataHeader> kVersions = const [ | 453 static const List<bindings.StructDataHeader> kVersions = const [ |
444 const bindings.StructDataHeader(8, 0) | 454 const bindings.StructDataHeader(8, 0) |
445 ]; | 455 ]; |
446 | 456 |
447 _ProcessControllerWaitParams() : super(kVersions.last.size); | 457 _ProcessControllerWaitParams() : super(kVersions.last.size); |
448 | 458 |
449 static _ProcessControllerWaitParams deserialize(bindings.Message message) { | 459 static _ProcessControllerWaitParams deserialize(bindings.Message message) { |
450 var decoder = new bindings.Decoder(message); | 460 var decoder = new bindings.Decoder(message); |
451 var result = decode(decoder); | 461 var result = decode(decoder); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 return "_ProcessControllerWaitParams("")"; | 500 return "_ProcessControllerWaitParams("")"; |
491 } | 501 } |
492 | 502 |
493 Map toJson() { | 503 Map toJson() { |
494 Map map = new Map(); | 504 Map map = new Map(); |
495 return map; | 505 return map; |
496 } | 506 } |
497 } | 507 } |
498 | 508 |
499 | 509 |
| 510 |
| 511 |
500 class ProcessControllerWaitResponseParams extends bindings.Struct { | 512 class ProcessControllerWaitResponseParams extends bindings.Struct { |
501 static const List<bindings.StructDataHeader> kVersions = const [ | 513 static const List<bindings.StructDataHeader> kVersions = const [ |
502 const bindings.StructDataHeader(16, 0) | 514 const bindings.StructDataHeader(16, 0) |
503 ]; | 515 ]; |
504 types_mojom.Error error = null; | 516 types_mojom.Error error = null; |
505 int exitStatus = 0; | 517 int exitStatus = 0; |
506 | 518 |
507 ProcessControllerWaitResponseParams() : super(kVersions.last.size); | 519 ProcessControllerWaitResponseParams() : super(kVersions.last.size); |
508 | 520 |
509 static ProcessControllerWaitResponseParams deserialize(bindings.Message messag
e) { | 521 static ProcessControllerWaitResponseParams deserialize(bindings.Message messag
e) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 | 582 |
571 Map toJson() { | 583 Map toJson() { |
572 Map map = new Map(); | 584 Map map = new Map(); |
573 map["error"] = error; | 585 map["error"] = error; |
574 map["exitStatus"] = exitStatus; | 586 map["exitStatus"] = exitStatus; |
575 return map; | 587 return map; |
576 } | 588 } |
577 } | 589 } |
578 | 590 |
579 | 591 |
| 592 |
| 593 |
580 class _ProcessControllerKillParams extends bindings.Struct { | 594 class _ProcessControllerKillParams extends bindings.Struct { |
581 static const List<bindings.StructDataHeader> kVersions = const [ | 595 static const List<bindings.StructDataHeader> kVersions = const [ |
582 const bindings.StructDataHeader(16, 0) | 596 const bindings.StructDataHeader(16, 0) |
583 ]; | 597 ]; |
584 int signal = 0; | 598 int signal = 0; |
585 | 599 |
586 _ProcessControllerKillParams() : super(kVersions.last.size); | 600 _ProcessControllerKillParams() : super(kVersions.last.size); |
587 | 601 |
588 static _ProcessControllerKillParams deserialize(bindings.Message message) { | 602 static _ProcessControllerKillParams deserialize(bindings.Message message) { |
589 var decoder = new bindings.Decoder(message); | 603 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 651 } |
638 | 652 |
639 Map toJson() { | 653 Map toJson() { |
640 Map map = new Map(); | 654 Map map = new Map(); |
641 map["signal"] = signal; | 655 map["signal"] = signal; |
642 return map; | 656 return map; |
643 } | 657 } |
644 } | 658 } |
645 | 659 |
646 | 660 |
| 661 |
| 662 |
647 class ProcessControllerKillResponseParams extends bindings.Struct { | 663 class ProcessControllerKillResponseParams extends bindings.Struct { |
648 static const List<bindings.StructDataHeader> kVersions = const [ | 664 static const List<bindings.StructDataHeader> kVersions = const [ |
649 const bindings.StructDataHeader(16, 0) | 665 const bindings.StructDataHeader(16, 0) |
650 ]; | 666 ]; |
651 types_mojom.Error error = null; | 667 types_mojom.Error error = null; |
652 | 668 |
653 ProcessControllerKillResponseParams() : super(kVersions.last.size); | 669 ProcessControllerKillResponseParams() : super(kVersions.last.size); |
654 | 670 |
655 static ProcessControllerKillResponseParams deserialize(bindings.Message messag
e) { | 671 static ProcessControllerKillResponseParams deserialize(bindings.Message messag
e) { |
656 var decoder = new bindings.Decoder(message); | 672 var decoder = new bindings.Decoder(message); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 "error: $error" ")"; | 723 "error: $error" ")"; |
708 } | 724 } |
709 | 725 |
710 Map toJson() { | 726 Map toJson() { |
711 Map map = new Map(); | 727 Map map = new Map(); |
712 map["error"] = error; | 728 map["error"] = error; |
713 return map; | 729 return map; |
714 } | 730 } |
715 } | 731 } |
716 | 732 |
| 733 |
| 734 |
| 735 |
717 const int _Process_spawnName = 0; | 736 const int _Process_spawnName = 0; |
718 const int _Process_spawnWithTerminalName = 1; | 737 const int _Process_spawnWithTerminalName = 1; |
719 | 738 |
| 739 |
| 740 |
| 741 class _ProcessServiceDescription implements service_describer.ServiceDescription
{ |
| 742 dynamic getTopLevelInterface([Function responseFactory = null]) => null; |
| 743 |
| 744 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) =
> |
| 745 null; |
| 746 |
| 747 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null; |
| 748 } |
| 749 |
720 abstract class Process { | 750 abstract class Process { |
721 static const String serviceName = "native_support::Process"; | 751 static const String serviceName = "native_support::Process"; |
722 dynamic spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,Object
stdinFile,Object stdoutFile,Object stderrFile,Object processController,[Function
responseFactory = null]); | 752 dynamic spawn(List<int> path,List<List<int>> argv,List<List<int>> envp,Object
stdinFile,Object stdoutFile,Object stderrFile,Object processController,[Function
responseFactory = null]); |
723 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,Object terminalFile,Object processController,[Function responseFactory = nu
ll]); | 753 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,Object terminalFile,Object processController,[Function responseFactory = nu
ll]); |
724 } | 754 } |
725 | 755 |
726 | 756 |
727 class _ProcessProxyImpl extends bindings.Proxy { | 757 class _ProcessProxyImpl extends bindings.Proxy { |
728 _ProcessProxyImpl.fromEndpoint( | 758 _ProcessProxyImpl.fromEndpoint( |
729 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 759 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
730 | 760 |
731 _ProcessProxyImpl.fromHandle(core.MojoHandle handle) : | 761 _ProcessProxyImpl.fromHandle(core.MojoHandle handle) : |
732 super.fromHandle(handle); | 762 super.fromHandle(handle); |
733 | 763 |
734 _ProcessProxyImpl.unbound() : super.unbound(); | 764 _ProcessProxyImpl.unbound() : super.unbound(); |
735 | 765 |
736 static _ProcessProxyImpl newFromEndpoint( | 766 static _ProcessProxyImpl newFromEndpoint( |
737 core.MojoMessagePipeEndpoint endpoint) { | 767 core.MojoMessagePipeEndpoint endpoint) { |
738 assert(endpoint.setDescription("For _ProcessProxyImpl")); | 768 assert(endpoint.setDescription("For _ProcessProxyImpl")); |
739 return new _ProcessProxyImpl.fromEndpoint(endpoint); | 769 return new _ProcessProxyImpl.fromEndpoint(endpoint); |
740 } | 770 } |
741 | 771 |
| 772 service_describer.ServiceDescription get serviceDescription => |
| 773 new _ProcessServiceDescription(); |
| 774 |
742 void handleResponse(bindings.ServiceMessage message) { | 775 void handleResponse(bindings.ServiceMessage message) { |
743 switch (message.header.type) { | 776 switch (message.header.type) { |
744 case _Process_spawnName: | 777 case _Process_spawnName: |
745 var r = ProcessSpawnResponseParams.deserialize( | 778 var r = ProcessSpawnResponseParams.deserialize( |
746 message.payload); | 779 message.payload); |
747 if (!message.header.hasRequestId) { | 780 if (!message.header.hasRequestId) { |
748 proxyError("Expected a message with a valid request Id."); | 781 proxyError("Expected a message with a valid request Id."); |
749 return; | 782 return; |
750 } | 783 } |
751 Completer c = completerMap[message.header.requestId]; | 784 Completer c = completerMap[message.header.requestId]; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 assert(_impl == null); | 1016 assert(_impl == null); |
984 _impl = d; | 1017 _impl = d; |
985 } | 1018 } |
986 | 1019 |
987 String toString() { | 1020 String toString() { |
988 var superString = super.toString(); | 1021 var superString = super.toString(); |
989 return "ProcessStub($superString)"; | 1022 return "ProcessStub($superString)"; |
990 } | 1023 } |
991 | 1024 |
992 int get version => 0; | 1025 int get version => 0; |
| 1026 |
| 1027 service_describer.ServiceDescription get serviceDescription => |
| 1028 new _ProcessServiceDescription(); |
993 } | 1029 } |
994 | 1030 |
995 const int _ProcessController_waitName = 0; | 1031 const int _ProcessController_waitName = 0; |
996 const int _ProcessController_killName = 1; | 1032 const int _ProcessController_killName = 1; |
997 | 1033 |
| 1034 |
| 1035 |
| 1036 class _ProcessControllerServiceDescription implements service_describer.ServiceD
escription { |
| 1037 dynamic getTopLevelInterface([Function responseFactory = null]) => null; |
| 1038 |
| 1039 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) =
> |
| 1040 null; |
| 1041 |
| 1042 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null; |
| 1043 } |
| 1044 |
998 abstract class ProcessController { | 1045 abstract class ProcessController { |
999 static const String serviceName = null; | 1046 static const String serviceName = null; |
1000 dynamic wait([Function responseFactory = null]); | 1047 dynamic wait([Function responseFactory = null]); |
1001 dynamic kill(int signal,[Function responseFactory = null]); | 1048 dynamic kill(int signal,[Function responseFactory = null]); |
1002 } | 1049 } |
1003 | 1050 |
1004 | 1051 |
1005 class _ProcessControllerProxyImpl extends bindings.Proxy { | 1052 class _ProcessControllerProxyImpl extends bindings.Proxy { |
1006 _ProcessControllerProxyImpl.fromEndpoint( | 1053 _ProcessControllerProxyImpl.fromEndpoint( |
1007 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 1054 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
1008 | 1055 |
1009 _ProcessControllerProxyImpl.fromHandle(core.MojoHandle handle) : | 1056 _ProcessControllerProxyImpl.fromHandle(core.MojoHandle handle) : |
1010 super.fromHandle(handle); | 1057 super.fromHandle(handle); |
1011 | 1058 |
1012 _ProcessControllerProxyImpl.unbound() : super.unbound(); | 1059 _ProcessControllerProxyImpl.unbound() : super.unbound(); |
1013 | 1060 |
1014 static _ProcessControllerProxyImpl newFromEndpoint( | 1061 static _ProcessControllerProxyImpl newFromEndpoint( |
1015 core.MojoMessagePipeEndpoint endpoint) { | 1062 core.MojoMessagePipeEndpoint endpoint) { |
1016 assert(endpoint.setDescription("For _ProcessControllerProxyImpl")); | 1063 assert(endpoint.setDescription("For _ProcessControllerProxyImpl")); |
1017 return new _ProcessControllerProxyImpl.fromEndpoint(endpoint); | 1064 return new _ProcessControllerProxyImpl.fromEndpoint(endpoint); |
1018 } | 1065 } |
1019 | 1066 |
| 1067 service_describer.ServiceDescription get serviceDescription => |
| 1068 new _ProcessControllerServiceDescription(); |
| 1069 |
1020 void handleResponse(bindings.ServiceMessage message) { | 1070 void handleResponse(bindings.ServiceMessage message) { |
1021 switch (message.header.type) { | 1071 switch (message.header.type) { |
1022 case _ProcessController_waitName: | 1072 case _ProcessController_waitName: |
1023 var r = ProcessControllerWaitResponseParams.deserialize( | 1073 var r = ProcessControllerWaitResponseParams.deserialize( |
1024 message.payload); | 1074 message.payload); |
1025 if (!message.header.hasRequestId) { | 1075 if (!message.header.hasRequestId) { |
1026 proxyError("Expected a message with a valid request Id."); | 1076 proxyError("Expected a message with a valid request Id."); |
1027 return; | 1077 return; |
1028 } | 1078 } |
1029 Completer c = completerMap[message.header.requestId]; | 1079 Completer c = completerMap[message.header.requestId]; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 assert(_impl == null); | 1301 assert(_impl == null); |
1252 _impl = d; | 1302 _impl = d; |
1253 } | 1303 } |
1254 | 1304 |
1255 String toString() { | 1305 String toString() { |
1256 var superString = super.toString(); | 1306 var superString = super.toString(); |
1257 return "ProcessControllerStub($superString)"; | 1307 return "ProcessControllerStub($superString)"; |
1258 } | 1308 } |
1259 | 1309 |
1260 int get version => 0; | 1310 int get version => 0; |
| 1311 |
| 1312 service_describer.ServiceDescription get serviceDescription => |
| 1313 new _ProcessControllerServiceDescription(); |
1261 } | 1314 } |
1262 | 1315 |
1263 | 1316 |
| 1317 |
| 1318 |
OLD | NEW |