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

Unified Diff: runtime/bin/process_impl.dart

Issue 10963024: Use native fields for process pid and fix bug that allowed killing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review commetns. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process.cc ('k') | tests/standalone/io/process_kill_unstarted_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_impl.dart
diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_impl.dart
index a6a819755d109d26e7e8875a3e95781a27b60e1f..a6e4424f59fa937892fb191ac716b148cbc3dfd7 100644
--- a/runtime/bin/process_impl.dart
+++ b/runtime/bin/process_impl.dart
@@ -10,7 +10,7 @@ class _ProcessStartStatus {
}
-class _Process extends Process {
+class _Process extends NativeFieldWrapperClass1 implements Process {
static Future<ProcessResult> run(String path,
List<String> arguments,
[ProcessOptions options]) {
@@ -227,22 +227,22 @@ class _Process extends Process {
throw new IllegalArgumentException(
"Argument 'signal' must be a ProcessSignal");
}
- if (_closed && _pid === null) {
- _reportError(new ProcessException("Process closed"));
+ if (!_started) {
+ var e = new ProcessException("Cannot kill process that is not started");
+ _reportError(e);
return;
}
if (_ended) {
return;
}
- // TODO(ager): Make the actual kill operation asynchronous.
- if (_kill(_pid, signal._signalNumber)) {
+ if (_kill(this, signal._signalNumber)) {
return;
}
_reportError(new ProcessException("Could not kill process"));
return;
}
- bool _kill(int pid, int signal) native "Process_Kill";
+ bool _kill(Process p, int signal) native "Process_Kill";
void close() {
if (_closed) {
@@ -290,7 +290,6 @@ class _Process extends Process {
_Socket _out;
_Socket _err;
Socket _exitHandler;
- int _pid;
bool _closed;
bool _ended;
bool _started;
« no previous file with comments | « runtime/bin/process.cc ('k') | tests/standalone/io/process_kill_unstarted_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698