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

Unified Diff: runtime/bin/main.cc

Issue 10134015: added package_root flag to standalone dart vm (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review fixes Created 8 years, 8 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
« runtime/bin/builtin.dart ('K') | « runtime/bin/builtin.dart ('k') | no next file » | 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 014c7230f669592e22a72050b0575c85e8d7784f..5d58979790f6487761572f7ce04f5e6f749d7a81 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -46,6 +46,12 @@ static const char* generate_pprof_symbols_filename = NULL;
static const char* breakpoint_at = NULL;
+// Value of the --package-root flag.
+// (This pointer points into an argv buffer and does not need to be
+// free'd.)
+static const char* package_root = NULL;
+
+
// Global flag that is used to indicate that we want to compile all the
// dart functions and not run anything.
static bool has_compile_all = false;
@@ -66,6 +72,12 @@ static void ProcessBreakpointOption(const char* funcname) {
}
+static void ProcessPackageRootOption(const char* arg) {
+ ASSERT(arg != NULL);
+ package_root = arg;
+}
+
+
static void ProcessCompileAllOption(const char* compile_all) {
ASSERT(compile_all != NULL);
has_compile_all = true;
@@ -83,7 +95,6 @@ static void ProcessImportMapOption(const char* map) {
import_map_options->AddArgument(map);
}
Ivan Posva 2012/04/26 05:32:09 Two lines.
-
static struct {
const char* option_name;
void (*process)(const char* option);
@@ -92,6 +103,7 @@ static struct {
{ "--compile_all", ProcessCompileAllOption },
{ "--generate_pprof_symbols=", ProcessPprofOption },
{ "--import_map=", ProcessImportMapOption },
+ { "--package-root=", ProcessPackageRootOption },
{ NULL, NULL }
};
@@ -366,7 +378,7 @@ static Dart_Handle LoadScript(Dart_Handle builtin_lib,
return Dart_LoadScript(script_url, source, LibraryTagHandler, import_map);
}
siva 2012/04/25 23:26:12 Missing blank line.
mattsh 2012/04/26 17:52:02 Done.
-
+// Returns true on success, false on failure.
static bool CreateIsolateAndSetup(const char* name_prefix,
void* data, char** error) {
Dart_Isolate isolate =
@@ -400,6 +412,22 @@ static bool CreateIsolateAndSetup(const char* name_prefix,
return false;
}
+ if (package_root != NULL) {
+ Dart_Handle dart_args[1];
+
+ Dart_Handle handle = Dart_NewString(package_root);
+ if (Dart_IsError(handle)) {
+ return false;
Ivan Posva 2012/04/26 05:32:09 This place is also missing the setup of the error
mattsh 2012/04/26 17:52:02 Done.
+ }
+ dart_args[0] = handle;
+
+ Dart_Handle result = Dart_Invoke(builtin_lib,
+ Dart_NewString("_setPackageRoot"), 1, dart_args);
+ if (Dart_IsError(result)) {
siva 2012/04/25 23:26:12 *error = strdup(Dart_GetError(result));
mattsh 2012/04/26 17:52:02 Done.
+ return false;
+ }
+ }
+
// Load the specified application script into the newly created isolate.
library = LoadScript(builtin_lib, import_map_options);
if (Dart_IsError(library)) {
« runtime/bin/builtin.dart ('K') | « runtime/bin/builtin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698