Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 * | 99 * |
| 100 * The target `main` must be a subtype of one of these three signatures: | 100 * The target `main` must be a subtype of one of these three signatures: |
| 101 * | 101 * |
| 102 * * `main()` | 102 * * `main()` |
| 103 * * `main(args)` | 103 * * `main(args)` |
| 104 * * `main(args, message)` | 104 * * `main(args, message)` |
| 105 * | 105 * |
| 106 * When present, the parameter `args` is set to the provided [args] list. | 106 * When present, the parameter `args` is set to the provided [args] list. |
| 107 * When present, the parameter `message` is set to the initial [message]. | 107 * When present, the parameter `message` is set to the initial [message]. |
| 108 * | 108 * |
| 109 * If the [packageRoot] parameter is passed, it is used as the location | |
| 110 * of packages in the spawned isolate. | |
| 111 * The `packageRoot` URI must be a "file" or "http"/"https" URI that ends | |
| 112 * in a slash. | |
| 113 * If it doesn't end in a slash, one will be added before using the URI. | |
|
Anders Johnsen
2014/08/04 12:54:48
I don't agree with this. Normally we would use Uri
Lasse Reichstein Nielsen
2014/08/04 13:27:26
The user will never want to write "file:///foo/bar
Anders Johnsen
2014/08/05 06:23:29
If I give it Platform.script, I expect it to work,
Lasse Reichstein Nielsen
2014/08/05 08:01:25
If we make new Uri.file(directory.path) end in a s
Lasse Reichstein Nielsen
2014/08/05 12:50:37
The --package-root argument on the VM command line
| |
| 114 * Package URIs (like "package:foo/bar.dart") in the new isolate are | |
|
Anders Johnsen
2014/08/04 12:54:48
URIs -> imports
| |
| 115 * resolved against this location, as by | |
| 116 * `packageRoot.resolve(Uri.parse("foo/bar.dart"))`. | |
|
Anders Johnsen
2014/08/04 12:54:48
This is contradicting the 'adding slash' as stated
Lasse Reichstein Nielsen
2014/08/04 13:27:26
True. It assumes the presence of the trailing slas
Lasse Reichstein Nielsen
2014/08/13 08:06:05
How about requiring the path to end in a slash, an
floitsch
2014/08/15 18:32:32
I think the packageRoot should behave similar to h
Lasse Reichstein Nielsen
2014/08/21 11:14:01
Agree. The URI must refer to a directory. If the p
| |
| 117 * This includes the main entry [uri] if it happens to be a package-URL. | |
| 118 * If [packageRoot] is omitted, the spawned isolate will use the same | |
| 119 * package root as the spawning isolate. | |
| 120 * | |
| 109 * Returns a future that will complete with an [Isolate] instance if the | 121 * Returns a future that will complete with an [Isolate] instance if the |
| 110 * spawning succeeded. It will complete with an error otherwise. | 122 * spawning succeeded. It will complete with an error otherwise. |
| 111 */ | 123 */ |
| 112 external static Future<Isolate> spawnUri( | 124 external static Future<Isolate> spawnUri( |
| 113 Uri uri, List<String> args, var message, { bool paused: false }); | 125 Uri uri, |
| 126 List<String> args, | |
| 127 var message, | |
| 128 { bool paused: false, | |
| 129 Uri packageRoot }); | |
| 114 | 130 |
| 115 /** | 131 /** |
| 116 * Requests the isolate to pause. | 132 * Requests the isolate to pause. |
| 117 * | 133 * |
| 118 * WARNING: This method is experimental and not handled on every platform yet. | 134 * WARNING: This method is experimental and not handled on every platform yet. |
| 119 * | 135 * |
| 120 * The isolate should stop handling events by pausing its event queue. | 136 * The isolate should stop handling events by pausing its event queue. |
| 121 * The request will eventually make the isolate stop doing anything. | 137 * The request will eventually make the isolate stop doing anything. |
| 122 * It will be handled before any other messages that are later sent to the | 138 * It will be handled before any other messages that are later sent to the |
| 123 * isolate from the current isolate, but no other guarantees are provided. | 139 * isolate from the current isolate, but no other guarantees are provided. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 : _description = description, | 528 : _description = description, |
| 513 stackTrace = new _RemoteStackTrace(stackDescription); | 529 stackTrace = new _RemoteStackTrace(stackDescription); |
| 514 String toString() => _description; | 530 String toString() => _description; |
| 515 } | 531 } |
| 516 | 532 |
| 517 class _RemoteStackTrace implements StackTrace { | 533 class _RemoteStackTrace implements StackTrace { |
| 518 String _trace; | 534 String _trace; |
| 519 _RemoteStackTrace(this._trace); | 535 _RemoteStackTrace(this._trace); |
| 520 String toString() => _trace; | 536 String toString() => _trace; |
| 521 } | 537 } |
| OLD | NEW |