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

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 1663963002: - reorganize DartUtils::PrepareForScriptLoading so that it does not have the wait for service load … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 10 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/dartutils.cc ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/gen_snapshot.cc
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 3e331796d1e128622efc2e63f126064612284eda..d783c8572dc7ea8fdd5fdd79e3100334a8f9ac32 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -256,12 +256,8 @@ static Dart_Handle ResolveUriInWorkingDirectory(const char* script_uri) {
// Run DartUtils::ResolveUriInWorkingDirectory in context of uri resolver
// isolate.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- CHECK_RESULT(builtin_lib);
-
Dart_Handle result = DartUtils::ResolveUriInWorkingDirectory(
- DartUtils::NewString(script_uri), builtin_lib);
+ DartUtils::NewString(script_uri));
if (Dart_IsError(result)) {
failed = true;
result_string = strdup(Dart_GetError(result));
@@ -285,12 +281,8 @@ static Dart_Handle FilePathFromUri(const char* script_uri) {
UriResolverIsolateScope scope;
// Run DartUtils::FilePathFromUri in context of uri resolver isolate.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- CHECK_RESULT(builtin_lib);
-
Dart_Handle result = DartUtils::FilePathFromUri(
- DartUtils::NewString(script_uri), builtin_lib);
+ DartUtils::NewString(script_uri));
if (Dart_IsError(result)) {
failed = true;
result_string = strdup(Dart_GetError(result));
@@ -314,14 +306,8 @@ static Dart_Handle ResolveUri(const char* library_uri, const char* uri) {
UriResolverIsolateScope scope;
// Run DartUtils::ResolveUri in context of uri resolver isolate.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- CHECK_RESULT(builtin_lib);
-
Dart_Handle result = DartUtils::ResolveUri(
- DartUtils::NewString(library_uri),
- DartUtils::NewString(uri),
- builtin_lib);
+ DartUtils::NewString(library_uri), DartUtils::NewString(uri));
if (Dart_IsError(result)) {
failed = true;
result_string = strdup(Dart_GetError(result));
@@ -959,12 +945,15 @@ static Dart_Isolate CreateServiceIsolate(const char* script_uri,
Dart_IsolateFlags* flags,
void* data,
char** error) {
+ IsolateData* isolate_data = new IsolateData(script_uri,
+ package_root,
+ package_config);
Dart_Isolate isolate = NULL;
isolate = Dart_CreateIsolate(script_uri,
main,
NULL,
NULL,
- NULL,
+ isolate_data,
error);
if (isolate == NULL) {
@@ -1055,8 +1044,9 @@ int main(int argc, char** argv) {
return 255;
}
+ IsolateData* isolate_data = new IsolateData(NULL, NULL, NULL);
Dart_Isolate isolate = Dart_CreateIsolate(
- NULL, NULL, NULL, NULL, NULL, &error);
+ NULL, NULL, NULL, NULL, isolate_data, &error);
if (isolate == NULL) {
Log::PrintErr("Error: %s", error);
free(error);
@@ -1078,24 +1068,21 @@ int main(int argc, char** argv) {
SetupForUriResolution();
- // Get handle to builtin library.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- CHECK_RESULT(builtin_lib);
+ // Prepare builtin and its dependent libraries for use to resolve URIs.
+ // Set up various closures, e.g: printing, timers etc.
+ // Set up 'package root' for URI resolution.
+ result = DartUtils::PrepareForScriptLoading(false, false);
+ CHECK_RESULT(result);
- // Ensure that we mark all libraries as loaded.
- result = Dart_FinalizeLoading(false);
+ // Set up the load port provided by the service isolate so that we can
+ // load scripts.
+ result = DartUtils::SetupServiceLoadPort();
CHECK_RESULT(result);
- // 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,
- NULL,
- false,
- false,
- builtin_lib);
+ // Setup package root if specified.
+ result = DartUtils::SetupPackageRoot(package_root, NULL);
CHECK_RESULT(result);
+
Dart_ExitScope();
Dart_ExitIsolate();
@@ -1103,7 +1090,9 @@ int main(int argc, char** argv) {
// Now we create an isolate into which we load all the code that needs to
// be in the snapshot.
- if (Dart_CreateIsolate(NULL, NULL, NULL, NULL, NULL, &error) == NULL) {
+ isolate_data = new IsolateData(NULL, NULL, NULL);
+ if (Dart_CreateIsolate(
+ NULL, NULL, NULL, NULL, isolate_data, &error) == NULL) {
fprintf(stderr, "%s", error);
free(error);
exit(255);
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698