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

Side by Side Diff: lib/isolate_runner.dart

Issue 1025293003: pkg/isolate: library renaming, removed unused method, fix creation of TimeoutException (Closed) Base URL: https://github.com/dart-lang/isolate.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart.pkg.isolate.isolaterunner; 5 library isolate.isolate_runner;
6 6
7 import "dart:isolate"; 7 import "dart:isolate";
8 import "dart:async"; 8 import "dart:async";
Lasse Reichstein Nielsen 2015/03/24 10:35:38 If you are reordering imports, put async before is
kevmoo 2015/03/24 13:21:19 Done.
9 import "runner.dart"; 9
10 import "ports.dart"; 10 import 'ports.dart';
11 import "src/lists.dart"; 11 import 'runner.dart';
12 import 'src/lists.dart';
12 13
13 // Command tags. Shared between IsolateRunner and IsolateRunnerRemote. 14 // Command tags. Shared between IsolateRunner and IsolateRunnerRemote.
14 const int _SHUTDOWN = 0; 15 const int _SHUTDOWN = 0;
15 const int _RUN = 1; 16 const int _RUN = 1;
16 17
17 /// An easier to use interface on top of an [Isolate]. 18 /// An easier to use interface on top of an [Isolate].
18 /// 19 ///
19 /// Wraps an `Isolate` and allows pausing, killing and inspecting 20 /// Wraps an `Isolate` and allows pausing, killing and inspecting
20 /// the isolate more conveniently than the raw `Isolate` methods. 21 /// the isolate more conveniently than the raw `Isolate` methods.
21 /// 22 ///
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 /// Paused isolates do respond to ping requests. 127 /// Paused isolates do respond to ping requests.
127 Future<bool> ping({Duration timeout: const Duration(seconds: 1)}) { 128 Future<bool> ping({Duration timeout: const Duration(seconds: 1)}) {
128 var channel = new SingleResponseChannel(callback: _kTrue, 129 var channel = new SingleResponseChannel(callback: _kTrue,
129 timeout: timeout, 130 timeout: timeout,
130 timeoutValue: false); 131 timeoutValue: false);
131 isolate.ping(channel.port); 132 isolate.ping(channel.port);
132 return channel.result; 133 return channel.result;
133 } 134 }
134 135
135 static bool _kTrue(_) => true; 136 static bool _kTrue(_) => true;
136 static bool _kFalse() => false;
137 137
138 /// Pauses the isolate. 138 /// Pauses the isolate.
139 /// 139 ///
140 /// While paused, no normal messages are processed, and calls to [run] will 140 /// While paused, no normal messages are processed, and calls to [run] will
141 /// be delayed until the isolate is resumed. 141 /// be delayed until the isolate is resumed.
142 /// 142 ///
143 /// Commands like [kill] and [ping] are still executed while the isolate is 143 /// Commands like [kill] and [ping] are still executed while the isolate is
144 /// paused. 144 /// paused.
145 /// 145 ///
146 /// If [resumeCapability] is omitted, it defaults to the [isolate]'s 146 /// If [resumeCapability] is omitted, it defaults to the [isolate]'s
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 case _RUN: 288 case _RUN:
289 Function function = command[1]; 289 Function function = command[1];
290 var argument = command[2]; 290 var argument = command[2];
291 SendPort responsePort = command[3]; 291 SendPort responsePort = command[3];
292 sendFutureResult(new Future.sync(() => function(argument)), 292 sendFutureResult(new Future.sync(() => function(argument)),
293 responsePort); 293 responsePort);
294 return; 294 return;
295 } 295 }
296 } 296 }
297 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698