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

Unified Diff: runtime/bin/main.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/isolate_data.h ('k') | runtime/bin/vmservice_impl.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 c61016f8f4581164f05321792f3d22608d755fc9..77625d80cb43adcef525d7e9007e74761c9d2d7b 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -743,30 +743,29 @@ static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
return isolate;
}
- // Load the specified application script into the newly created isolate.
-
- // Prepare builtin and its dependent libraries for use to resolve URIs.
- // The builtin library is part of the core snapshot and would already be
- // available here in the case of script snapshot loading.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- CHECK_RESULT(builtin_lib);
-
- // 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,
- packages_config,
- false,
- has_trace_loading,
- builtin_lib);
+ // Prepare builtin and other core 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, has_trace_loading);
+ CHECK_RESULT(result);
+
+ // Set up the load port provided by the service isolate so that we can
+ // load scripts.
+ result = DartUtils::SetupServiceLoadPort();
+ CHECK_RESULT(result);
+
+ // Setup package root if specified.
+ result = DartUtils::SetupPackageRoot(package_root, packages_config);
CHECK_RESULT(result);
result = Dart_SetEnvironmentCallback(EnvironmentCallback);
CHECK_RESULT(result);
if (!has_run_precompiled_snapshot) {
+ // Load the specified application script into the newly created isolate.
+
// Load the script.
- result = DartUtils::LoadScript(script_uri, builtin_lib);
+ result = DartUtils::LoadScript(script_uri);
CHECK_RESULT(result);
// Run event-loop and wait for script loading to complete.
@@ -1174,11 +1173,10 @@ bool RunMainIsolate(const char* script_name,
Dart_Handle root_lib = Dart_RootLibrary();
// Import the root library into the builtin library so that we can easily
// lookup the main entry point exported from the root library.
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- ASSERT(!Dart_IsError(builtin_lib));
- result = Dart_LibraryImportLibrary(builtin_lib, root_lib, Dart_Null());
-
+ IsolateData* isolate_data =
+ reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate));
+ result = Dart_LibraryImportLibrary(
+ isolate_data->builtin_lib(), root_lib, Dart_Null());
if (has_gen_precompiled_snapshot) {
// Load the embedder's portion of the VM service's Dart code so it will
// be included in the precompiled snapshot.
@@ -1268,7 +1266,7 @@ bool RunMainIsolate(const char* script_name,
// The helper function _getMainClosure creates a closure for the main
// entry point which is either explicitly or implictly exported from the
// root library.
- Dart_Handle main_closure = Dart_Invoke(builtin_lib,
+ Dart_Handle main_closure = Dart_Invoke(isolate_data->builtin_lib(),
Dart_NewStringFromCString("_getMainClosure"), 0, NULL);
CHECK_RESULT(main_closure);
« no previous file with comments | « runtime/bin/isolate_data.h ('k') | runtime/bin/vmservice_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698