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

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: Add the actual native field to Process 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
Index: runtime/bin/process_impl.dart
diff --git a/runtime/bin/process_impl.dart b/runtime/bin/process_impl.dart
index a6a819755d109d26e7e8875a3e95781a27b60e1f..26718fc0d889fcb5f3d6f1ab0b37651ed6d36157 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,21 @@ class _Process extends Process {
throw new IllegalArgumentException(
"Argument 'signal' must be a ProcessSignal");
}
- if (_closed && _pid === null) {
- _reportError(new ProcessException("Process closed"));
+ if (!_started) {
+ _reportError(new ProcessException("Cannot kill process that is not started"));
Søren Gjesse 2012/09/21 10:44:16 Long line.
Mads Ager (google) 2012/09/21 11:07:39 Done.
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 +289,6 @@ class _Process extends Process {
_Socket _out;
_Socket _err;
Socket _exitHandler;
- int _pid;
bool _closed;
bool _ended;
bool _started;

Powered by Google App Engine
This is Rietveld 408576698