Chromium Code Reviews| Index: runtime/bin/main.cc |
| diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
| index 014c7230f669592e22a72050b0575c85e8d7784f..d5933045be5266ddd0405d7d3aad6e251b8f4518 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; |
|
siva
2012/04/22 00:14:01
need to initialize this to NULL otherwise your che
mattsh
2012/04/23 16:48:09
Actually C/C++ guarantee to initialize statics to
|
| + |
| + |
| // 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; |
| +} |
| 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); |
| } |
| - |
| 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 } |
| }; |
| @@ -400,6 +410,12 @@ static bool CreateIsolateAndSetup(const char* name_prefix, |
| return false; |
| } |
| + if (package_root != NULL) { |
| + Dart_Handle dart_args[1]; |
| + dart_args[0] = Dart_NewString(package_root); |
|
siva
2012/04/22 00:14:01
Dart_NewString can return errors and that needs to
mattsh
2012/04/23 16:48:09
Added a TODO
siva
2012/04/23 17:16:45
Not sure why this needs to be a TODO and not fixed
mattsh
2012/04/23 18:12:55
OK, now added the error handling here and removed
|
| + Dart_Invoke(builtin_lib, Dart_NewString("_setPackageRoot"), 1, dart_args); |
|
siva
2012/04/22 00:14:01
The return value from Dart_NewString and Dart_Invo
mattsh
2012/04/23 16:48:09
Added a TODO to add the error handling.
siva
2012/04/23 17:16:45
Ditto comment about why this needs to be a TODO.
mattsh
2012/04/23 18:12:55
Done.
mattsh
2012/04/23 18:12:55
Done.
|
| + } |
| + |
| // Load the specified application script into the newly created isolate. |
| library = LoadScript(builtin_lib, import_map_options); |
| if (Dart_IsError(library)) { |