Chromium Code Reviews| 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)) { |