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

Unified Diff: runtime/bin/main.cc

Issue 1403693002: - Implement package map parameter when spawning isolate. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years, 2 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 | « runtime/bin/gen_snapshot.cc ('k') | runtime/bin/vmservice_dartium.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index d829587c59589dec5a673a598426aecf7591af58..1429ff4e65315ec2d5760de07f3f8c92ad1eebbc 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -706,6 +706,7 @@ static Dart_Handle EnvironmentCallback(Dart_Handle name) {
static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
const char* main,
const char* package_root,
+ const char** package_map,
const char* packages_file,
Dart_IsolateFlags* flags,
char** error,
@@ -767,6 +768,7 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
// Prepare for script loading by setting up the 'print' and 'timer'
// closures and setting up 'package root' for URI resolution.
result = DartUtils::PrepareForScriptLoading(package_root,
+ package_map,
packages_file,
false,
has_trace_loading,
@@ -815,13 +817,18 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
const char* main,
const char* package_root,
+ const char** package_map,
Dart_IsolateFlags* flags,
void* data, char** error) {
// The VM should never call the isolate helper with a NULL flags.
ASSERT(flags != NULL);
ASSERT(flags->version == DART_FLAGS_CURRENT_VERSION);
+ if ((package_root != NULL) && (package_map != NULL)) {
+ *error = strdup("Invalid arguments - Cannot simultaneously specify "
+ "package root and package map.");
+ return NULL;
+ }
IsolateData* parent_isolate_data = reinterpret_cast<IsolateData*>(data);
- int exit_code = 0;
if (script_uri == NULL) {
if (data == NULL) {
*error = strdup("Invalid 'callback_data' - Unable to spawn new isolate");
@@ -834,15 +841,20 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
}
}
const char* packages_file = NULL;
- if (package_root == NULL) {
+ // If neither a package root nor a package map are requested pass on the
+ // inherited values.
+ if ((package_root == NULL) && (package_map == NULL)) {
if (parent_isolate_data != NULL) {
package_root = parent_isolate_data->package_root;
packages_file = parent_isolate_data->packages_file;
}
}
+
+ int exit_code = 0;
return CreateIsolateAndSetupHelper(script_uri,
main,
package_root,
+ package_map,
packages_file,
flags,
error,
@@ -1116,6 +1128,7 @@ bool RunMainIsolate(const char* script_name,
Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name,
"main",
commandline_package_root,
+ NULL,
commandline_packages_file,
NULL,
&error,
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | runtime/bin/vmservice_dartium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698