Chromium Code Reviews| Index: runtime/bin/process.cc |
| diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc |
| index 740e4a4e5011a6ba8b7582083e18e88cae38b5d3..88cb896af0b42b5b070b2203dc45a7eb8da40670 100644 |
| --- a/runtime/bin/process.cc |
| +++ b/runtime/bin/process.cc |
| @@ -12,6 +12,8 @@ |
| static const int kProcessIdNativeField = 0; |
| +int Process::global_exit_code_ = 0; |
| +dart::Mutex Process::global_exit_code_mutex_; |
| // Extract an array of C strings from a list of Dart strings. |
| static char** ExtractCStringList(Dart_Handle strings, |
| @@ -168,6 +170,26 @@ void FUNCTION_NAME(Process_Kill)(Dart_NativeArguments args) { |
| } |
| +void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
| + Dart_EnterScope(); |
| + int64_t status = 0; |
| + // Ignore result if passing invalid argument and just exit 0. |
| + DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| + Dart_ExitScope(); |
| + exit(static_cast<int>(status)); |
| +} |
| + |
| + |
| +void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) { |
| + Dart_EnterScope(); |
| + int64_t status = 0; |
| + // Ignore result if passing invalid argument and just set exit code to 0. |
| + DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| + Dart_ExitScope(); |
|
Søren Gjesse
2012/12/21 10:01:06
Move Dart_ExitScope to the end of the function.
Mads Ager (google)
2012/12/21 10:37:40
That comment looks familiar. I forgot to move that
|
| + Process::SetGlobalExitCode(status); |
| +} |
| + |
| + |
| Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, |
| intptr_t* pid) { |
| return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); |