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; |
| 743 |
| 744 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 745 |
| 746 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 747 } |
| 748 |
720 abstract class Process { | 749 abstract class Process { |
721 static const String serviceName = "native_support::Process"; | 750 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]); | 751 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]); | 752 dynamic spawnWithTerminal(List<int> path,List<List<int>> argv,List<List<int>>
envp,Object terminalFile,Object processController,[Function responseFactory = nu
ll]); |
724 } | 753 } |
725 | 754 |
726 | 755 |
727 class _ProcessProxyImpl extends bindings.Proxy { | 756 class _ProcessProxyImpl extends bindings.Proxy { |
728 _ProcessProxyImpl.fromEndpoint( | 757 _ProcessProxyImpl.fromEndpoint( |
729 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 758 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
730 | 759 |
731 _ProcessProxyImpl.fromHandle(core.MojoHandle handle) : | 760 _ProcessProxyImpl.fromHandle(core.MojoHandle handle) : |
732 super.fromHandle(handle); | 761 super.fromHandle(handle); |
733 | 762 |
734 _ProcessProxyImpl.unbound() : super.unbound(); | 763 _ProcessProxyImpl.unbound() : super.unbound(); |
735 | 764 |
736 static _ProcessProxyImpl newFromEndpoint( | 765 static _ProcessProxyImpl newFromEndpoint( |
737 core.MojoMessagePipeEndpoint endpoint) { | 766 core.MojoMessagePipeEndpoint endpoint) { |
738 assert(endpoint.setDescription("For _ProcessProxyImpl")); | 767 assert(endpoint.setDescription("For _ProcessProxyImpl")); |
739 return new _ProcessProxyImpl.fromEndpoint(endpoint); | 768 return new _ProcessProxyImpl.fromEndpoint(endpoint); |
740 } | 769 } |
741 | 770 |
| 771 service_describer.ServiceDescription get serviceDescription => |
| 772 new _ProcessServiceDescription(); |
| 773 |
742 void handleResponse(bindings.ServiceMessage message) { | 774 void handleResponse(bindings.ServiceMessage message) { |
743 switch (message.header.type) { | 775 switch (message.header.type) { |
744 case _Process_spawnName: | 776 case _Process_spawnName: |
745 var r = ProcessSpawnResponseParams.deserialize( | 777 var r = ProcessSpawnResponseParams.deserialize( |
746 message.payload); | 778 message.payload); |
747 if (!message.header.hasRequestId) { | 779 if (!message.header.hasRequestId) { |
748 proxyError("Expected a message with a valid request Id."); | 780 proxyError("Expected a message with a valid request Id."); |
749 return; | 781 return; |
750 } | 782 } |
751 Completer c = completerMap[message.header.requestId]; | 783 Completer c = completerMap[message.header.requestId]; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 assert(_impl == null); | 1015 assert(_impl == null); |
984 _impl = d; | 1016 _impl = d; |
985 } | 1017 } |
986 | 1018 |
987 String toString() { | 1019 String toString() { |
988 var superString = super.toString(); | 1020 var superString = super.toString(); |
989 return "ProcessStub($superString)"; | 1021 return "ProcessStub($superString)"; |
990 } | 1022 } |
991 | 1023 |
992 int get version => 0; | 1024 int get version => 0; |
| 1025 |
| 1026 service_describer.ServiceDescription get serviceDescription => |
| 1027 new _ProcessServiceDescription(); |
993 } | 1028 } |
994 | 1029 |
995 const int _ProcessController_waitName = 0; | 1030 const int _ProcessController_waitName = 0; |
996 const int _ProcessController_killName = 1; | 1031 const int _ProcessController_killName = 1; |
997 | 1032 |
| 1033 |
| 1034 |
| 1035 class _ProcessControllerServiceDescription implements service_describer.ServiceD
escription { |
| 1036 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 1037 |
| 1038 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 1039 |
| 1040 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 1041 } |
| 1042 |
998 abstract class ProcessController { | 1043 abstract class ProcessController { |
999 static const String serviceName = null; | 1044 static const String serviceName = null; |
1000 dynamic wait([Function responseFactory = null]); | 1045 dynamic wait([Function responseFactory = null]); |
1001 dynamic kill(int signal,[Function responseFactory = null]); | 1046 dynamic kill(int signal,[Function responseFactory = null]); |
1002 } | 1047 } |
1003 | 1048 |
1004 | 1049 |
1005 class _ProcessControllerProxyImpl extends bindings.Proxy { | 1050 class _ProcessControllerProxyImpl extends bindings.Proxy { |
1006 _ProcessControllerProxyImpl.fromEndpoint( | 1051 _ProcessControllerProxyImpl.fromEndpoint( |
1007 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 1052 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
1008 | 1053 |
1009 _ProcessControllerProxyImpl.fromHandle(core.MojoHandle handle) : | 1054 _ProcessControllerProxyImpl.fromHandle(core.MojoHandle handle) : |
1010 super.fromHandle(handle); | 1055 super.fromHandle(handle); |
1011 | 1056 |
1012 _ProcessControllerProxyImpl.unbound() : super.unbound(); | 1057 _ProcessControllerProxyImpl.unbound() : super.unbound(); |
1013 | 1058 |
1014 static _ProcessControllerProxyImpl newFromEndpoint( | 1059 static _ProcessControllerProxyImpl newFromEndpoint( |
1015 core.MojoMessagePipeEndpoint endpoint) { | 1060 core.MojoMessagePipeEndpoint endpoint) { |
1016 assert(endpoint.setDescription("For _ProcessControllerProxyImpl")); | 1061 assert(endpoint.setDescription("For _ProcessControllerProxyImpl")); |
1017 return new _ProcessControllerProxyImpl.fromEndpoint(endpoint); | 1062 return new _ProcessControllerProxyImpl.fromEndpoint(endpoint); |
1018 } | 1063 } |
1019 | 1064 |
| 1065 service_describer.ServiceDescription get serviceDescription => |
| 1066 new _ProcessControllerServiceDescription(); |
| 1067 |
1020 void handleResponse(bindings.ServiceMessage message) { | 1068 void handleResponse(bindings.ServiceMessage message) { |
1021 switch (message.header.type) { | 1069 switch (message.header.type) { |
1022 case _ProcessController_waitName: | 1070 case _ProcessController_waitName: |
1023 var r = ProcessControllerWaitResponseParams.deserialize( | 1071 var r = ProcessControllerWaitResponseParams.deserialize( |
1024 message.payload); | 1072 message.payload); |
1025 if (!message.header.hasRequestId) { | 1073 if (!message.header.hasRequestId) { |
1026 proxyError("Expected a message with a valid request Id."); | 1074 proxyError("Expected a message with a valid request Id."); |
1027 return; | 1075 return; |
1028 } | 1076 } |
1029 Completer c = completerMap[message.header.requestId]; | 1077 Completer c = completerMap[message.header.requestId]; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 assert(_impl == null); | 1299 assert(_impl == null); |
1252 _impl = d; | 1300 _impl = d; |
1253 } | 1301 } |
1254 | 1302 |
1255 String toString() { | 1303 String toString() { |
1256 var superString = super.toString(); | 1304 var superString = super.toString(); |
1257 return "ProcessControllerStub($superString)"; | 1305 return "ProcessControllerStub($superString)"; |
1258 } | 1306 } |
1259 | 1307 |
1260 int get version => 0; | 1308 int get version => 0; |
| 1309 |
| 1310 service_describer.ServiceDescription get serviceDescription => |
| 1311 new _ProcessControllerServiceDescription(); |
1261 } | 1312 } |
1262 | 1313 |
1263 | 1314 |
| 1315 |
OLD | NEW |