| 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 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; |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 impl.requireVersion(requiredVersion); | 982 impl.requireVersion(requiredVersion); |
| 983 } | 983 } |
| 984 | 984 |
| 985 String toString() { | 985 String toString() { |
| 986 return "ProcessProxy($impl)"; | 986 return "ProcessProxy($impl)"; |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 | 990 |
| 991 class ProcessStub extends bindings.Stub { | 991 class ProcessStub extends bindings.Stub { |
| 992 Process _impl = null; | 992 Process _impl; |
| 993 | 993 |
| 994 ProcessStub.fromEndpoint( | 994 ProcessStub.fromEndpoint( |
| 995 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 995 core.MojoMessagePipeEndpoint endpoint, [Process impl]) |
| 996 : super.fromEndpoint(endpoint); | 996 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 997 _impl = impl; |
| 998 } |
| 997 | 999 |
| 998 ProcessStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1000 ProcessStub.fromHandle( |
| 999 : super.fromHandle(handle); | 1001 core.MojoHandle handle, [Process impl]) |
| 1002 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1003 _impl = impl; |
| 1004 } |
| 1000 | 1005 |
| 1001 ProcessStub.unbound() : super.unbound(); | 1006 ProcessStub.unbound() : super.unbound(); |
| 1002 | 1007 |
| 1003 static ProcessStub newFromEndpoint( | 1008 static ProcessStub newFromEndpoint( |
| 1004 core.MojoMessagePipeEndpoint endpoint) { | 1009 core.MojoMessagePipeEndpoint endpoint) { |
| 1005 assert(endpoint.setDescription("For ProcessStub")); | 1010 assert(endpoint.setDescription("For ProcessStub")); |
| 1006 return new ProcessStub.fromEndpoint(endpoint); | 1011 return new ProcessStub.fromEndpoint(endpoint); |
| 1007 } | 1012 } |
| 1008 | 1013 |
| 1009 | 1014 |
| 1010 ProcessSpawnResponseParams _processSpawnResponseParamsFactory(types_mojom.Erro
r error) { | 1015 ProcessSpawnResponseParams _processSpawnResponseParamsFactory(types_mojom.Erro
r error) { |
| 1011 var result = new ProcessSpawnResponseParams(); | 1016 var result = new ProcessSpawnResponseParams(); |
| 1012 result.error = error; | 1017 result.error = error; |
| 1013 return result; | 1018 return result; |
| 1014 } | 1019 } |
| 1015 ProcessSpawnWithTerminalResponseParams _processSpawnWithTerminalResponseParams
Factory(types_mojom.Error error) { | 1020 ProcessSpawnWithTerminalResponseParams _processSpawnWithTerminalResponseParams
Factory(types_mojom.Error error) { |
| 1016 var result = new ProcessSpawnWithTerminalResponseParams(); | 1021 var result = new ProcessSpawnWithTerminalResponseParams(); |
| 1017 result.error = error; | 1022 result.error = error; |
| 1018 return result; | 1023 return result; |
| 1019 } | 1024 } |
| 1020 | 1025 |
| 1021 dynamic handleMessage(bindings.ServiceMessage message) { | 1026 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1022 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1027 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1023 return bindings.ControlMessageHandler.handleMessage(this, | 1028 return bindings.ControlMessageHandler.handleMessage(this, |
| 1024 0, | 1029 0, |
| 1025 message); | 1030 message); |
| 1026 } | 1031 } |
| 1027 assert(_impl != null); | 1032 if (_impl == null) { |
| 1033 throw new core.MojoApiError("$this has no implementation set"); |
| 1034 } |
| 1028 switch (message.header.type) { | 1035 switch (message.header.type) { |
| 1029 case _processMethodSpawnName: | 1036 case _processMethodSpawnName: |
| 1030 var params = _ProcessSpawnParams.deserialize( | 1037 var params = _ProcessSpawnParams.deserialize( |
| 1031 message.payload); | 1038 message.payload); |
| 1032 var response = _impl.spawn(params.path,params.argv,params.envp,params.st
dinFile,params.stdoutFile,params.stderrFile,params.processController,_processSpa
wnResponseParamsFactory); | 1039 var response = _impl.spawn(params.path,params.argv,params.envp,params.st
dinFile,params.stdoutFile,params.stderrFile,params.processController,_processSpa
wnResponseParamsFactory); |
| 1033 if (response is Future) { | 1040 if (response is Future) { |
| 1034 return response.then((response) { | 1041 return response.then((response) { |
| 1035 if (response != null) { | 1042 if (response != null) { |
| 1036 return buildResponseWithId( | 1043 return buildResponseWithId( |
| 1037 response, | 1044 response, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 break; | 1079 break; |
| 1073 default: | 1080 default: |
| 1074 throw new bindings.MojoCodecError("Unexpected message name"); | 1081 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1075 break; | 1082 break; |
| 1076 } | 1083 } |
| 1077 return null; | 1084 return null; |
| 1078 } | 1085 } |
| 1079 | 1086 |
| 1080 Process get impl => _impl; | 1087 Process get impl => _impl; |
| 1081 set impl(Process d) { | 1088 set impl(Process d) { |
| 1082 assert(_impl == null); | 1089 if (d == null) { |
| 1090 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1091 } |
| 1092 if (isBound && (_impl == null)) { |
| 1093 beginHandlingEvents(); |
| 1094 } |
| 1083 _impl = d; | 1095 _impl = d; |
| 1084 } | 1096 } |
| 1085 | 1097 |
| 1098 @override |
| 1099 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1100 super.bind(endpoint); |
| 1101 if (!isOpen && (_impl != null)) { |
| 1102 beginHandlingEvents(); |
| 1103 } |
| 1104 } |
| 1105 |
| 1086 String toString() { | 1106 String toString() { |
| 1087 var superString = super.toString(); | 1107 var superString = super.toString(); |
| 1088 return "ProcessStub($superString)"; | 1108 return "ProcessStub($superString)"; |
| 1089 } | 1109 } |
| 1090 | 1110 |
| 1091 int get version => 0; | 1111 int get version => 0; |
| 1092 | 1112 |
| 1093 static service_describer.ServiceDescription _cachedServiceDescription; | 1113 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1094 static service_describer.ServiceDescription get serviceDescription { | 1114 static service_describer.ServiceDescription get serviceDescription { |
| 1095 if (_cachedServiceDescription == null) { | 1115 if (_cachedServiceDescription == null) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 impl.requireVersion(requiredVersion); | 1291 impl.requireVersion(requiredVersion); |
| 1272 } | 1292 } |
| 1273 | 1293 |
| 1274 String toString() { | 1294 String toString() { |
| 1275 return "ProcessControllerProxy($impl)"; | 1295 return "ProcessControllerProxy($impl)"; |
| 1276 } | 1296 } |
| 1277 } | 1297 } |
| 1278 | 1298 |
| 1279 | 1299 |
| 1280 class ProcessControllerStub extends bindings.Stub { | 1300 class ProcessControllerStub extends bindings.Stub { |
| 1281 ProcessController _impl = null; | 1301 ProcessController _impl; |
| 1282 | 1302 |
| 1283 ProcessControllerStub.fromEndpoint( | 1303 ProcessControllerStub.fromEndpoint( |
| 1284 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 1304 core.MojoMessagePipeEndpoint endpoint, [ProcessController impl]) |
| 1285 : super.fromEndpoint(endpoint); | 1305 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 1306 _impl = impl; |
| 1307 } |
| 1286 | 1308 |
| 1287 ProcessControllerStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1309 ProcessControllerStub.fromHandle( |
| 1288 : super.fromHandle(handle); | 1310 core.MojoHandle handle, [ProcessController impl]) |
| 1311 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1312 _impl = impl; |
| 1313 } |
| 1289 | 1314 |
| 1290 ProcessControllerStub.unbound() : super.unbound(); | 1315 ProcessControllerStub.unbound() : super.unbound(); |
| 1291 | 1316 |
| 1292 static ProcessControllerStub newFromEndpoint( | 1317 static ProcessControllerStub newFromEndpoint( |
| 1293 core.MojoMessagePipeEndpoint endpoint) { | 1318 core.MojoMessagePipeEndpoint endpoint) { |
| 1294 assert(endpoint.setDescription("For ProcessControllerStub")); | 1319 assert(endpoint.setDescription("For ProcessControllerStub")); |
| 1295 return new ProcessControllerStub.fromEndpoint(endpoint); | 1320 return new ProcessControllerStub.fromEndpoint(endpoint); |
| 1296 } | 1321 } |
| 1297 | 1322 |
| 1298 | 1323 |
| 1299 ProcessControllerWaitResponseParams _processControllerWaitResponseParamsFactor
y(types_mojom.Error error, int exitStatus) { | 1324 ProcessControllerWaitResponseParams _processControllerWaitResponseParamsFactor
y(types_mojom.Error error, int exitStatus) { |
| 1300 var result = new ProcessControllerWaitResponseParams(); | 1325 var result = new ProcessControllerWaitResponseParams(); |
| 1301 result.error = error; | 1326 result.error = error; |
| 1302 result.exitStatus = exitStatus; | 1327 result.exitStatus = exitStatus; |
| 1303 return result; | 1328 return result; |
| 1304 } | 1329 } |
| 1305 ProcessControllerKillResponseParams _processControllerKillResponseParamsFactor
y(types_mojom.Error error) { | 1330 ProcessControllerKillResponseParams _processControllerKillResponseParamsFactor
y(types_mojom.Error error) { |
| 1306 var result = new ProcessControllerKillResponseParams(); | 1331 var result = new ProcessControllerKillResponseParams(); |
| 1307 result.error = error; | 1332 result.error = error; |
| 1308 return result; | 1333 return result; |
| 1309 } | 1334 } |
| 1310 | 1335 |
| 1311 dynamic handleMessage(bindings.ServiceMessage message) { | 1336 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1312 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1337 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1313 return bindings.ControlMessageHandler.handleMessage(this, | 1338 return bindings.ControlMessageHandler.handleMessage(this, |
| 1314 0, | 1339 0, |
| 1315 message); | 1340 message); |
| 1316 } | 1341 } |
| 1317 assert(_impl != null); | 1342 if (_impl == null) { |
| 1343 throw new core.MojoApiError("$this has no implementation set"); |
| 1344 } |
| 1318 switch (message.header.type) { | 1345 switch (message.header.type) { |
| 1319 case _processControllerMethodWaitName: | 1346 case _processControllerMethodWaitName: |
| 1320 var response = _impl.wait(_processControllerWaitResponseParamsFactory); | 1347 var response = _impl.wait(_processControllerWaitResponseParamsFactory); |
| 1321 if (response is Future) { | 1348 if (response is Future) { |
| 1322 return response.then((response) { | 1349 return response.then((response) { |
| 1323 if (response != null) { | 1350 if (response != null) { |
| 1324 return buildResponseWithId( | 1351 return buildResponseWithId( |
| 1325 response, | 1352 response, |
| 1326 _processControllerMethodWaitName, | 1353 _processControllerMethodWaitName, |
| 1327 message.header.requestId, | 1354 message.header.requestId, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 break; | 1387 break; |
| 1361 default: | 1388 default: |
| 1362 throw new bindings.MojoCodecError("Unexpected message name"); | 1389 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1363 break; | 1390 break; |
| 1364 } | 1391 } |
| 1365 return null; | 1392 return null; |
| 1366 } | 1393 } |
| 1367 | 1394 |
| 1368 ProcessController get impl => _impl; | 1395 ProcessController get impl => _impl; |
| 1369 set impl(ProcessController d) { | 1396 set impl(ProcessController d) { |
| 1370 assert(_impl == null); | 1397 if (d == null) { |
| 1398 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1399 } |
| 1400 if (isBound && (_impl == null)) { |
| 1401 beginHandlingEvents(); |
| 1402 } |
| 1371 _impl = d; | 1403 _impl = d; |
| 1372 } | 1404 } |
| 1373 | 1405 |
| 1406 @override |
| 1407 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1408 super.bind(endpoint); |
| 1409 if (!isOpen && (_impl != null)) { |
| 1410 beginHandlingEvents(); |
| 1411 } |
| 1412 } |
| 1413 |
| 1374 String toString() { | 1414 String toString() { |
| 1375 var superString = super.toString(); | 1415 var superString = super.toString(); |
| 1376 return "ProcessControllerStub($superString)"; | 1416 return "ProcessControllerStub($superString)"; |
| 1377 } | 1417 } |
| 1378 | 1418 |
| 1379 int get version => 0; | 1419 int get version => 0; |
| 1380 | 1420 |
| 1381 static service_describer.ServiceDescription _cachedServiceDescription; | 1421 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1382 static service_describer.ServiceDescription get serviceDescription { | 1422 static service_describer.ServiceDescription get serviceDescription { |
| 1383 if (_cachedServiceDescription == null) { | 1423 if (_cachedServiceDescription == null) { |
| 1384 _cachedServiceDescription = new _ProcessControllerServiceDescription(); | 1424 _cachedServiceDescription = new _ProcessControllerServiceDescription(); |
| 1385 } | 1425 } |
| 1386 return _cachedServiceDescription; | 1426 return _cachedServiceDescription; |
| 1387 } | 1427 } |
| 1388 } | 1428 } |
| 1389 | 1429 |
| 1390 | 1430 |
| 1391 | 1431 |
| OLD | NEW |