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

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: add error handling 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
« no previous file with comments | « 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..01c8a6a9c47d455b24e9d7e2b189b7b63a6fd56e 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;
@@ -65,6 +71,10 @@ static void ProcessBreakpointOption(const char* funcname) {
breakpoint_at = funcname;
}
+static void ProcessPackageRootOption(const char* arg) {
+ ASSERT(arg != NULL);
+ package_root = arg;
+}
Ivan Posva 2012/04/25 16:25:19 Two lines, as in the rest of the file, please.
mattsh 2012/04/25 17:12:10 Done.
static void ProcessCompileAllOption(const char* compile_all) {
ASSERT(compile_all != NULL);
@@ -83,7 +93,6 @@ static void ProcessImportMapOption(const char* map) {
import_map_options->AddArgument(map);
}
Ivan Posva 2012/04/25 16:25:19 Why this removed line?
mattsh 2012/04/25 17:12:10 Done.
-
static struct {
const char* option_name;
void (*process)(const char* option);
@@ -92,6 +101,7 @@ static struct {
{ "--compile_all", ProcessCompileAllOption },
{ "--generate_pprof_symbols=", ProcessPprofOption },
{ "--import_map=", ProcessImportMapOption },
+ { "--package_root=", ProcessPackageRootOption },
{ NULL, NULL }
};
@@ -366,7 +376,7 @@ static Dart_Handle LoadScript(Dart_Handle builtin_lib,
return Dart_LoadScript(script_url, source, LibraryTagHandler, import_map);
}
-
+// returns true on success, false on failure
Ivan Posva 2012/04/25 16:25:19 Comments end with . and start with a capital. Make
mattsh 2012/04/25 17:12:10 Done.
static bool CreateIsolateAndSetup(const char* name_prefix,
void* data, char** error) {
Dart_Isolate isolate =
@@ -400,6 +410,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;
+ }
+ dart_args[0] = handle;
+
+ Dart_Handle result = Dart_Invoke(builtin_lib,
+ Dart_NewString("_setPackageRoot"), 1, dart_args);
+ if (Dart_IsError(result)) {
+ return false;
+ }
+ }
+
// Load the specified application script into the newly created isolate.
library = LoadScript(builtin_lib, import_map_options);
if (Dart_IsError(library)) {
« no previous file with comments | « runtime/bin/builtin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698