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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 * If the parameter is omitted, the new isolate will inherit the | 228 * If the parameter is omitted, the new isolate will inherit the |
229 * value from the current isolate. | 229 * value from the current isolate. |
230 * | 230 * |
231 * It may not always be possible to honor the `checked` parameter. | 231 * It may not always be possible to honor the `checked` parameter. |
232 * If the isolate code was pre-compiled, it may not be possible to change | 232 * If the isolate code was pre-compiled, it may not be possible to change |
233 * the checked mode setting dynamically. | 233 * the checked mode setting dynamically. |
234 * In that case, the `checked` parameter is ignored. | 234 * In that case, the `checked` parameter is ignored. |
235 * | 235 * |
236 * WARNING: The [checked] parameter is not implemented on all platforms yet. | 236 * WARNING: The [checked] parameter is not implemented on all platforms yet. |
237 * | 237 * |
238 * If either the [packageRoot] or the [packages] parameter is provided, | 238 * If either the [packageRoot] or the [packageMap] parameter is provided, |
239 * it is used to find the location of package sources in the spawned isolate. | 239 * it is used to find the location of package sources in the spawned isolate. |
240 * | 240 * |
241 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies | 241 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies |
242 * a directory. If it doesn't end in a slash, one will be added before | 242 * a directory. If it doesn't end in a slash, one will be added before |
243 * using the URI, and any query or fragment parts are ignored. | 243 * using the URI, and any query or fragment parts are ignored. |
244 * Package imports (like `"package:foo/bar.dart"`) in the new isolate are | 244 * Package imports (like `"package:foo/bar.dart"`) in the new isolate are |
245 * resolved against this location, as by | 245 * resolved against this location, as by |
246 * `packageRoot.resolve("foo/bar.dart")`. | 246 * `packageRoot.resolve("foo/bar.dart")`. |
247 * | 247 * |
248 * The `packages` map maps package names to URIs with the same requirements | 248 * The `packageMap` map maps package names to URIs with the same requirements |
249 * as `packageRoot`. Package imports (like `"package:foo/bar/baz.dart"`) in | 249 * as `packageRoot`. Package imports (like `"package:foo/bar/baz.dart"`) in |
250 * the new isolate are resolved against the URI for that package (if any), | 250 * the new isolate are resolved against the URI for that package (if any), |
251 * as by `packages["foo"].resolve("bar/baz.dart") | 251 * as by `packages["foo"].resolve("bar/baz.dart") |
252 * | 252 * |
253 * This resolution also applies to the main entry [uri] | 253 * This resolution also applies to the main entry [uri] |
254 * if that happens to be a package-URI. | 254 * if that happens to be a package-URI. |
255 * | 255 * |
256 * If both [packageRoot] and [packages] are omitted, the new isolate uses | 256 * If both [packageRoot] and [packageMap] are omitted, the new isolate uses |
257 * the same package resolution as the current isolate. | 257 * the same package resolution as the current isolate. |
258 * It's not allowed to provide both a `packageRoot` and a `package` parameter. | 258 * It's not allowed to provide both a `packageRoot` and a `package` parameter. |
259 * | 259 * |
260 * WARNING: The [packageRoot] and [packages] parameters are not implemented | 260 * WARNING: The [packageRoot] and [packageMap] parameters are not implemented |
261 * on all platforms yet. | 261 * on all platforms yet. |
262 * | 262 * |
263 * The [environment] is a mapping from strings to strings which the | 263 * The [environment] is a mapping from strings to strings which the |
264 * spawned isolate uses when looking up [String.fromEnvironment] values. | 264 * spawned isolate uses when looking up [String.fromEnvironment] values. |
265 * The system may add its own entries to environment as well. | 265 * The system may add its own entries to environment as well. |
266 * If `environment` is omitted, the spawned isolate has the same environment | 266 * If `environment` is omitted, the spawned isolate has the same environment |
267 * declarations as the spawning isolate. | 267 * declarations as the spawning isolate. |
268 * | 268 * |
269 * WARNING: The [environment] parameter is not implemented on all | 269 * WARNING: The [environment] parameter is not implemented on all |
270 * platforms yet. | 270 * platforms yet. |
271 * | 271 * |
272 * Returns a future that will complete with an [Isolate] instance if the | 272 * Returns a future that will complete with an [Isolate] instance if the |
273 * spawning succeeded. It will complete with an error otherwise. | 273 * spawning succeeded. It will complete with an error otherwise. |
274 */ | 274 */ |
275 external static Future<Isolate> spawnUri( | 275 external static Future<Isolate> spawnUri( |
276 Uri uri, | 276 Uri uri, |
277 List<String> args, | 277 List<String> args, |
278 var message, | 278 var message, |
279 {bool paused: false, | 279 {bool paused: false, |
280 SendPort onExit, | 280 SendPort onExit, |
281 SendPort onError, | 281 SendPort onError, |
282 bool errorsAreFatal, | 282 bool errorsAreFatal, |
283 bool checked, | 283 bool checked, |
284 Map<String, String> environment, | 284 Map<String, String> environment, |
285 Uri packageRoot, | 285 Uri packageRoot, |
286 Map<String, Uri> packages}); | 286 Map<String, Uri> packageMap}); |
287 | 287 |
288 /** | 288 /** |
289 * Requests the isolate to pause. | 289 * Requests the isolate to pause. |
290 * | 290 * |
291 * The isolate should stop handling events by pausing its event queue. | 291 * The isolate should stop handling events by pausing its event queue. |
292 * The request will eventually make the isolate stop doing anything. | 292 * The request will eventually make the isolate stop doing anything. |
293 * It will be handled before any other messages that are later sent to the | 293 * It will be handled before any other messages that are later sent to the |
294 * isolate from the current isolate, but no other guarantees are provided. | 294 * isolate from the current isolate, but no other guarantees are provided. |
295 * | 295 * |
296 * The event loop may be paused before previously sent, but not yet exeuted, | 296 * 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... |
680 * as the original error, but has no other features of the original error. | 680 * as the original error, but has no other features of the original error. |
681 */ | 681 */ |
682 class RemoteError implements Error { | 682 class RemoteError implements Error { |
683 final String _description; | 683 final String _description; |
684 final StackTrace stackTrace; | 684 final StackTrace stackTrace; |
685 RemoteError(String description, String stackDescription) | 685 RemoteError(String description, String stackDescription) |
686 : _description = description, | 686 : _description = description, |
687 stackTrace = new StackTrace.fromString(stackDescription); | 687 stackTrace = new StackTrace.fromString(stackDescription); |
688 String toString() => _description; | 688 String toString() => _description; |
689 } | 689 } |
OLD | NEW |