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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 * | 165 * |
| 166 * The target `main` must be a subtype of one of these three signatures: | 166 * The target `main` must be a subtype of one of these three signatures: |
| 167 * | 167 * |
| 168 * * `main()` | 168 * * `main()` |
| 169 * * `main(args)` | 169 * * `main(args)` |
| 170 * * `main(args, message)` | 170 * * `main(args, message)` |
| 171 * | 171 * |
| 172 * When present, the parameter `args` is set to the provided [args] list. | 172 * When present, the parameter `args` is set to the provided [args] list. |
| 173 * When present, the parameter `message` is set to the initial [message]. | 173 * When present, the parameter `message` is set to the initial [message]. |
| 174 * | 174 * |
| 175 * If the [paused] parameter is set to `true`, | |
| 176 * the isolate will start up in a paused state, | |
| 177 * as if by an initial call of `isolate.pause(isolate.pauseCapability)`. | |
| 178 * This allows setting up error or exit listeners on the isolate | |
| 179 * before it starts running. | |
| 180 * To resume the isolate, call `isolate.resume(isolate.pauseCapability)`. | |
| 181 * | |
| 182 * If the [checked] parameter is set to `true` or `false`, | |
| 183 * the new isolate will run code in checked mode, | |
| 184 * respectively in production mode, if possible. | |
| 185 * If the parameter is omitted, the new isolate will inherit the | |
| 186 * value from the current isolate. | |
| 187 * | |
| 188 * If the isolate code was pre-compiled, it may not be possible to change | |
| 189 * the checked mode setting dynamically. | |
| 190 * | |
| 191 * WARNING: The [checked] parameter is not implemented on all platforms yet. | |
|
kevmoo
2015/06/02 17:42:55
We have no plan to implement this in dart2js, righ
Lasse Reichstein Nielsen
2015/06/03 06:55:25
We could implement it by appending "?checked" to t
| |
| 192 * | |
| 175 * If the [packageRoot] parameter is provided, it is used to find the location | 193 * If the [packageRoot] parameter is provided, it is used to find the location |
| 176 * of packages imports in the spawned isolate. | 194 * of packages imports in the spawned isolate. |
| 177 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies | 195 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies |
| 178 * a directory. If it doesn't end in a slash, one will be added before | 196 * a directory. If it doesn't end in a slash, one will be added before |
| 179 * using the URI, and any query or fragment parts are ignored. | 197 * using the URI, and any query or fragment parts are ignored. |
| 180 * Package imports (like "package:foo/bar.dart") in the new isolate are | 198 * Package imports (like "package:foo/bar.dart") in the new isolate are |
| 181 * resolved against this location, as by | 199 * resolved against this location, as by |
| 182 * `packageRoot.resolve("foo/bar.dart")`. | 200 * `packageRoot.resolve("foo/bar.dart")`. |
| 183 * This includes the main entry [uri] if it happens to be a package-URL. | 201 * This includes the main entry [uri] if it happens to be a package-URL. |
| 184 * If [packageRoot] is omitted, it defaults to the same URI that | 202 * If [packageRoot] is omitted, it defaults to the same URI that |
| 185 * the current isolate is using. | 203 * the current isolate is using. |
| 186 * | 204 * |
| 187 * WARNING: The [packageRoot] parameter is not implemented on all | 205 * WARNING: The [packageRoot] parameter is not implemented on all |
| 188 * platforms yet. | 206 * platforms yet. |
| 189 * | 207 * |
| 190 * If the [paused] parameter is set to `true`, | |
| 191 * the isolate will start up in a paused state, | |
| 192 * as if by an initial call of `isolate.pause(isolate.pauseCapability)`. | |
| 193 * This allows setting up error or exit listeners on the isolate | |
| 194 * before it starts running. | |
| 195 * To resume the isolate, call `isolate.resume(isolate.pauseCapability)`. | |
| 196 * | |
| 197 * WARNING: The `pause` parameter is not implemented on all platforms yet. | |
| 198 * | |
| 199 * Returns a future that will complete with an [Isolate] instance if the | 208 * Returns a future that will complete with an [Isolate] instance if the |
| 200 * spawning succeeded. It will complete with an error otherwise. | 209 * spawning succeeded. It will complete with an error otherwise. |
| 201 */ | 210 */ |
| 202 external static Future<Isolate> spawnUri( | 211 external static Future<Isolate> spawnUri( |
| 203 Uri uri, | 212 Uri uri, |
| 204 List<String> args, | 213 List<String> args, |
| 205 var message, | 214 var message, |
| 206 {bool paused: false, | 215 {bool paused: false, |
| 216 bool checked, | |
| 207 Uri packageRoot}); | 217 Uri packageRoot}); |
| 208 | 218 |
| 209 /** | 219 /** |
| 210 * Requests the isolate to pause. | 220 * Requests the isolate to pause. |
| 211 * | 221 * |
| 212 * The isolate should stop handling events by pausing its event queue. | 222 * The isolate should stop handling events by pausing its event queue. |
| 213 * The request will eventually make the isolate stop doing anything. | 223 * The request will eventually make the isolate stop doing anything. |
| 214 * It will be handled before any other messages that are later sent to the | 224 * It will be handled before any other messages that are later sent to the |
| 215 * isolate from the current isolate, but no other guarantees are provided. | 225 * isolate from the current isolate, but no other guarantees are provided. |
| 216 * | 226 * |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 * as the original error, but has no other features of the original error. | 590 * as the original error, but has no other features of the original error. |
| 581 */ | 591 */ |
| 582 class RemoteError implements Error { | 592 class RemoteError implements Error { |
| 583 final String _description; | 593 final String _description; |
| 584 final StackTrace stackTrace; | 594 final StackTrace stackTrace; |
| 585 RemoteError(String description, String stackDescription) | 595 RemoteError(String description, String stackDescription) |
| 586 : _description = description, | 596 : _description = description, |
| 587 stackTrace = new StackTrace.fromString(stackDescription); | 597 stackTrace = new StackTrace.fromString(stackDescription); |
| 588 String toString() => _description; | 598 String toString() => _description; |
| 589 } | 599 } |
| OLD | NEW |