Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: sdk/lib/isolate/isolate.dart

Issue 1323373002: Add `packages` parameter to `Isolate.spawnUri`. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix typo in documentation. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_patch.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 * If the parameter is omitted, the new isolate will inherit the 205 * If the parameter is omitted, the new isolate will inherit the
206 * value from the current isolate. 206 * value from the current isolate.
207 * 207 *
208 * It may not always be possible to honor the `checked` parameter. 208 * It may not always be possible to honor the `checked` parameter.
209 * If the isolate code was pre-compiled, it may not be possible to change 209 * If the isolate code was pre-compiled, it may not be possible to change
210 * the checked mode setting dynamically. 210 * the checked mode setting dynamically.
211 * In that case, the `checked` parameter is ignored. 211 * In that case, the `checked` parameter is ignored.
212 * 212 *
213 * WARNING: The [checked] parameter is not implemented on all platforms yet. 213 * WARNING: The [checked] parameter is not implemented on all platforms yet.
214 * 214 *
215 * If the [packageRoot] parameter is provided, it is used to find the location 215 * If either the [packageRoot] or the [packages] parameter is provided,
216 * of packages imports in the spawned isolate. 216 * it is used to find the location of package sources in the spawned isolate.
217 *
217 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies 218 * The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies
218 * a directory. If it doesn't end in a slash, one will be added before 219 * a directory. If it doesn't end in a slash, one will be added before
219 * using the URI, and any query or fragment parts are ignored. 220 * using the URI, and any query or fragment parts are ignored.
220 * Package imports (like "package:foo/bar.dart") in the new isolate are 221 * Package imports (like `"package:foo/bar.dart"`) in the new isolate are
221 * resolved against this location, as by 222 * resolved against this location, as by
222 * `packageRoot.resolve("foo/bar.dart")`. 223 * `packageRoot.resolve("foo/bar.dart")`.
223 * This includes the main entry [uri] if it happens to be a package-URL.
224 * If [packageRoot] is omitted, it defaults to the same URI that
225 * the current isolate is using.
226 * 224 *
227 * WARNING: The [packageRoot] parameter is not implemented on all 225 * The `packages` map maps package names to URIs with the same requirements
228 * platforms yet. 226 * as `packageRoot`. Package imports (like `"package:foo/bar/baz.dart"`) in
227 * the new isolate are resolved against the URI for that package (if any),
228 * as by `packages["foo"].resolve("bar/baz.dart")
229 *
230 * This resolution also applies to the main entry [uri]
231 * if that happens to be a package-URI.
232 *
233 * If both [packageRoot] and [packages] are omitted, the new isolate uses
234 * the same package resolution as the current isolate.
235 * It's not allowed to provide both a `packageRoot` and a `package` parameter.
236 *
237 * WARNING: The [packageRoot] and [packages] parameters are not implemented
238 * on all platforms yet.
229 * 239 *
230 * Returns a future that will complete with an [Isolate] instance if the 240 * Returns a future that will complete with an [Isolate] instance if the
231 * spawning succeeded. It will complete with an error otherwise. 241 * spawning succeeded. It will complete with an error otherwise.
232 */ 242 */
233 external static Future<Isolate> spawnUri( 243 external static Future<Isolate> spawnUri(
234 Uri uri, 244 Uri uri,
235 List<String> args, 245 List<String> args,
236 var message, 246 var message,
237 {bool paused: false, 247 {bool paused: false,
238 bool checked, 248 bool checked,
239 Uri packageRoot, 249 Uri packageRoot,
250 Map<String, Uri> packages,
240 bool errorsAreFatal, 251 bool errorsAreFatal,
241 SendPort onExit, 252 SendPort onExit,
242 SendPort onError}); 253 SendPort onError});
243 254
244 /** 255 /**
245 * Requests the isolate to pause. 256 * Requests the isolate to pause.
246 * 257 *
247 * The isolate should stop handling events by pausing its event queue. 258 * The isolate should stop handling events by pausing its event queue.
248 * The request will eventually make the isolate stop doing anything. 259 * The request will eventually make the isolate stop doing anything.
249 * It will be handled before any other messages that are later sent to the 260 * It will be handled before any other messages that are later sent to the
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 * as the original error, but has no other features of the original error. 647 * as the original error, but has no other features of the original error.
637 */ 648 */
638 class RemoteError implements Error { 649 class RemoteError implements Error {
639 final String _description; 650 final String _description;
640 final StackTrace stackTrace; 651 final StackTrace stackTrace;
641 RemoteError(String description, String stackDescription) 652 RemoteError(String description, String stackDescription)
642 : _description = description, 653 : _description = description,
643 stackTrace = new StackTrace.fromString(stackDescription); 654 stackTrace = new StackTrace.fromString(stackDescription);
644 String toString() => _description; 655 String toString() => _description;
645 } 656 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/isolate_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698