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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 /** | 120 /** |
| 121 * Return the current [Isolate]. | 121 * Return the current [Isolate]. |
| 122 * | 122 * |
| 123 * The isolate gives access to the capabilities needed to inspect, | 123 * The isolate gives access to the capabilities needed to inspect, |
| 124 * pause or kill the isolate, and allows granting these capabilities | 124 * pause or kill the isolate, and allows granting these capabilities |
| 125 * to others. | 125 * to others. |
| 126 */ | 126 */ |
| 127 external static Isolate get current; | 127 external static Isolate get current; |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * Returns the package root of the current isolate, if any. | |
| 131 * | |
| 132 * If the isolate is using a [packageConfig] or the isolate has not been | |
| 133 * setup for package resolution, this getter returns `null`, otherwise it | |
| 134 * returns the package root - a directory that package URIs are resolved | |
| 135 * against. | |
| 136 */ | |
|
rmacnak
2016/01/13 01:39:00
Note how this value can differ from Platform.packa
| |
| 137 external static Future<Uri> get packageRoot; | |
| 138 | |
| 139 /** | |
| 140 * Returns the package root of the current isolate, if any. | |
|
rmacnak
2016/01/13 01:39:00
package root => location of the package config
| |
| 141 * | |
| 142 * If the isolate is using a [packageRoot] or the isolate has not been | |
| 143 * setup for package resolution, this getter returns `null`, otherwise it | |
| 144 * returns the package config URI. | |
| 145 */ | |
|
rmacnak
2016/01/13 01:39:00
Note how this value can differ from Platform.packa
| |
| 146 external static Future<Uri> get packageConfig; | |
| 147 | |
| 148 /** | |
| 149 * Maps a package: URI to a non-package Uri. | |
| 150 * | |
| 151 * If there is no valid mapping from the package: URI in the current | |
| 152 * isolate, then this call returns `null`. Non-package: URI are | |
|
rmacnak
2016/01/13 01:39:00
Non-package: URIs
Ivan Posva
2016/01/13 02:13:15
Done.
| |
| 153 * returned unmodified. | |
| 154 */ | |
| 155 external static Future<Uri> resolvePackageUri(Uri packageUri); | |
| 156 | |
| 157 /** | |
| 130 * Creates and spawns an isolate that shares the same code as the current | 158 * Creates and spawns an isolate that shares the same code as the current |
| 131 * isolate. | 159 * isolate. |
| 132 * | 160 * |
| 133 * The argument [entryPoint] specifies the entry point of the spawned | 161 * The argument [entryPoint] specifies the entry point of the spawned |
| 134 * isolate. It must be a top-level function or a static method that | 162 * isolate. It must be a top-level function or a static method that |
| 135 * takes one argument - that is, one-parameter functions that can be | 163 * takes one argument - that is, one-parameter functions that can be |
| 136 * compile-time constant function values. | 164 * compile-time constant function values. |
| 137 * It is not allowed to pass the value of function expressions or an instance | 165 * It is not allowed to pass the value of function expressions or an instance |
| 138 * method extracted from an object. | 166 * method extracted from an object. |
| 139 * | 167 * |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 * The system may add its own entries to environment as well. | 255 * The system may add its own entries to environment as well. |
| 228 * If `environment` is omitted, the spawned isolate has the same environment | 256 * If `environment` is omitted, the spawned isolate has the same environment |
| 229 * declarations as the spawning isolate. | 257 * declarations as the spawning isolate. |
| 230 * | 258 * |
| 231 * WARNING: The [environment] parameter is not implemented on all | 259 * WARNING: The [environment] parameter is not implemented on all |
| 232 * platforms yet. | 260 * platforms yet. |
| 233 * | 261 * |
| 234 * Returns a future that will complete with an [Isolate] instance if the | 262 * Returns a future that will complete with an [Isolate] instance if the |
| 235 * spawning succeeded. It will complete with an error otherwise. | 263 * spawning succeeded. It will complete with an error otherwise. |
| 236 */ | 264 */ |
| 237 external static Future<Isolate> spawnUri( | 265 external static Future<Isolate> spawnUri( |
|
kevmoo
2016/01/13 01:40:18
Document the new arguments
Ivan Posva
2016/01/13 02:13:15
Done.
| |
| 238 Uri uri, | 266 Uri uri, |
| 239 List<String> args, | 267 List<String> args, |
| 240 var message, | 268 var message, |
| 241 {bool paused: false, | 269 {bool paused: false, |
| 242 SendPort onExit, | 270 SendPort onExit, |
| 243 SendPort onError, | 271 SendPort onError, |
| 244 bool errorsAreFatal, | 272 bool errorsAreFatal, |
| 245 bool checked, | 273 bool checked, |
| 246 Map<String, String> environment, | 274 Map<String, String> environment, |
| 247 Uri packageRoot}); | 275 Uri packageRoot, |
| 276 Uri packageConfig, | |
| 277 bool automaticPackageResolution: false}); | |
| 248 | 278 |
| 249 /** | 279 /** |
| 250 * Requests the isolate to pause. | 280 * Requests the isolate to pause. |
| 251 * | 281 * |
| 252 * The isolate should stop handling events by pausing its event queue. | 282 * The isolate should stop handling events by pausing its event queue. |
| 253 * The request will eventually make the isolate stop doing anything. | 283 * The request will eventually make the isolate stop doing anything. |
| 254 * It will be handled before any other messages that are later sent to the | 284 * It will be handled before any other messages that are later sent to the |
| 255 * isolate from the current isolate, but no other guarantees are provided. | 285 * isolate from the current isolate, but no other guarantees are provided. |
| 256 * | 286 * |
| 257 * The event loop may be paused before previously sent, but not yet exeuted, | 287 * The event loop may be paused before previously sent, but not yet exeuted, |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 * as the original error, but has no other features of the original error. | 644 * as the original error, but has no other features of the original error. |
| 615 */ | 645 */ |
| 616 class RemoteError implements Error { | 646 class RemoteError implements Error { |
| 617 final String _description; | 647 final String _description; |
| 618 final StackTrace stackTrace; | 648 final StackTrace stackTrace; |
| 619 RemoteError(String description, String stackDescription) | 649 RemoteError(String description, String stackDescription) |
| 620 : _description = description, | 650 : _description = description, |
| 621 stackTrace = new StackTrace.fromString(stackDescription); | 651 stackTrace = new StackTrace.fromString(stackDescription); |
| 622 String toString() => _description; | 652 String toString() => _description; |
| 623 } | 653 } |
| OLD | NEW |