OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Concurrent programming using _isolates_: | 6 * Concurrent programming using _isolates_: |
7 * independent workers that are similar to threads | 7 * independent workers that are similar to threads |
8 * but don't share memory, | 8 * but don't share memory, |
9 * communicating only via messages. | 9 * communicating only via messages. |
10 */ | 10 */ |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 * This resolution also applies to the main entry [uri] | 230 * This resolution also applies to the main entry [uri] |
231 * if that happens to be a package-URI. | 231 * if that happens to be a package-URI. |
232 * | 232 * |
233 * If both [packageRoot] and [packages] are omitted, the new isolate uses | 233 * If both [packageRoot] and [packages] are omitted, the new isolate uses |
234 * the same package resolution as the current isolate. | 234 * the same package resolution as the current isolate. |
235 * It's not allowed to provide both a `packageRoot` and a `package` parameter. | 235 * It's not allowed to provide both a `packageRoot` and a `package` parameter. |
236 * | 236 * |
237 * WARNING: The [packageRoot] and [packages] parameters are not implemented | 237 * WARNING: The [packageRoot] and [packages] parameters are not implemented |
238 * on all platforms yet. | 238 * on all platforms yet. |
239 * | 239 * |
| 240 * The [environment] is a mapping from strings to strings which the |
| 241 * spawned isolate uses when looking up [String.fromEnvironment] values. |
| 242 * The system may add its own entries to environment as well. |
| 243 * If `environment` is omitted, the spawned isolate has the same environment |
| 244 * declarations as the spawning isolate. |
| 245 * |
| 246 * WARNING: The [environment] parameter is not implemented on all |
| 247 * platforms yet. |
| 248 * |
240 * Returns a future that will complete with an [Isolate] instance if the | 249 * Returns a future that will complete with an [Isolate] instance if the |
241 * spawning succeeded. It will complete with an error otherwise. | 250 * spawning succeeded. It will complete with an error otherwise. |
242 */ | 251 */ |
243 external static Future<Isolate> spawnUri( | 252 external static Future<Isolate> spawnUri( |
244 Uri uri, | 253 Uri uri, |
245 List<String> args, | 254 List<String> args, |
246 var message, | 255 var message, |
247 {bool paused: false, | 256 {bool paused: false, |
| 257 SendPort onExit, |
| 258 SendPort onError, |
| 259 bool errorsAreFatal, |
248 bool checked, | 260 bool checked, |
| 261 Map<String, String> environment, |
249 Uri packageRoot, | 262 Uri packageRoot, |
250 Map<String, Uri> packages, | 263 Map<String, Uri> packages}); |
251 bool errorsAreFatal, | |
252 SendPort onExit, | |
253 SendPort onError}); | |
254 | 264 |
255 /** | 265 /** |
256 * Requests the isolate to pause. | 266 * Requests the isolate to pause. |
257 * | 267 * |
258 * The isolate should stop handling events by pausing its event queue. | 268 * The isolate should stop handling events by pausing its event queue. |
259 * The request will eventually make the isolate stop doing anything. | 269 * The request will eventually make the isolate stop doing anything. |
260 * It will be handled before any other messages that are later sent to the | 270 * It will be handled before any other messages that are later sent to the |
261 * isolate from the current isolate, but no other guarantees are provided. | 271 * isolate from the current isolate, but no other guarantees are provided. |
262 * | 272 * |
263 * The event loop may be paused before previously sent, but not yet exeuted, | 273 * The event loop may be paused before previously sent, but not yet exeuted, |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 * as the original error, but has no other features of the original error. | 657 * as the original error, but has no other features of the original error. |
648 */ | 658 */ |
649 class RemoteError implements Error { | 659 class RemoteError implements Error { |
650 final String _description; | 660 final String _description; |
651 final StackTrace stackTrace; | 661 final StackTrace stackTrace; |
652 RemoteError(String description, String stackDescription) | 662 RemoteError(String description, String stackDescription) |
653 : _description = description, | 663 : _description = description, |
654 stackTrace = new StackTrace.fromString(stackDescription); | 664 stackTrace = new StackTrace.fromString(stackDescription); |
655 String toString() => _description; | 665 String toString() => _description; |
656 } | 666 } |
OLD | NEW |