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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/isolate/isolate.dart
diff --git a/sdk/lib/isolate/isolate.dart b/sdk/lib/isolate/isolate.dart
index d239ef2b322e65c3d1d412371a1063308785f8c8..d5534ba71436bc0e4e10d6f12928165e9102b407 100644
--- a/sdk/lib/isolate/isolate.dart
+++ b/sdk/lib/isolate/isolate.dart
@@ -212,20 +212,30 @@ class Isolate {
*
* WARNING: The [checked] parameter is not implemented on all platforms yet.
*
- * If the [packageRoot] parameter is provided, it is used to find the location
- * of packages imports in the spawned isolate.
+ * If either the [packageRoot] or the [packages] parameter is provided,
+ * it is used to find the location of package sources in the spawned isolate.
+ *
* The `packageRoot` URI must be a "file" or "http"/"https" URI that specifies
* a directory. If it doesn't end in a slash, one will be added before
* using the URI, and any query or fragment parts are ignored.
- * Package imports (like "package:foo/bar.dart") in the new isolate are
+ * Package imports (like `"package:foo/bar.dart"`) in the new isolate are
* resolved against this location, as by
* `packageRoot.resolve("foo/bar.dart")`.
- * This includes the main entry [uri] if it happens to be a package-URL.
- * If [packageRoot] is omitted, it defaults to the same URI that
- * the current isolate is using.
*
- * WARNING: The [packageRoot] parameter is not implemented on all
- * platforms yet.
+ * The `packages` map maps package names to URIs with the same requirements
+ * as `packageRoot`. Package imports (like `"package:foo/bar/baz.dart"`) in
+ * the new isolate are resolved against the URI for that package (if any),
+ * as by `packages["foo"].resolve("bar/baz.dart")
+ *
+ * This resolution also applies to the main entry [uri]
+ * if that happens to be a package-URI.
+ *
+ * If both [packageRoot] and [packages] are omitted, the new isolate uses
+ * the same package resolution as the current isolate.
+ * It's not allowed to provide both a `packageRoot` and a `package` parameter.
+ *
+ * WARNING: The [packageRoot] and [packages] parameters are not implemented
+ * on all platforms yet.
*
* Returns a future that will complete with an [Isolate] instance if the
* spawning succeeded. It will complete with an error otherwise.
@@ -237,6 +247,7 @@ class Isolate {
{bool paused: false,
bool checked,
Uri packageRoot,
+ Map<String, Uri> packages,
bool errorsAreFatal,
SendPort onExit,
SendPort onError});
« 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