| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 #include "bin/io_buffer.h" | 6 #include "bin/io_buffer.h" |
| 7 #include "bin/platform.h" | 7 #include "bin/platform.h" |
| 8 #include "bin/process.h" | 8 #include "bin/process.h" |
| 9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
| 10 #include "bin/utils.h" |
| 10 | 11 |
| 11 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 namespace bin { | 15 namespace bin { |
| 15 | 16 |
| 16 static const int kProcessIdNativeField = 0; | 17 static const int kProcessIdNativeField = 0; |
| 17 | 18 |
| 18 int Process::global_exit_code_ = 0; | 19 int Process::global_exit_code_ = 0; |
| 19 dart::Mutex* Process::global_exit_code_mutex_ = new dart::Mutex(); | 20 dart::Mutex* Process::global_exit_code_mutex_ = new dart::Mutex(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 Process::SetGlobalExitCode(status); | 221 Process::SetGlobalExitCode(status); |
| 221 } | 222 } |
| 222 | 223 |
| 223 | 224 |
| 224 void FUNCTION_NAME(Process_GetExitCode)(Dart_NativeArguments args) { | 225 void FUNCTION_NAME(Process_GetExitCode)(Dart_NativeArguments args) { |
| 225 Dart_SetReturnValue(args, Dart_NewInteger(Process::GlobalExitCode())); | 226 Dart_SetReturnValue(args, Dart_NewInteger(Process::GlobalExitCode())); |
| 226 } | 227 } |
| 227 | 228 |
| 228 | 229 |
| 229 void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) { | 230 void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) { |
| 231 ScopedBlockingCall blocker; |
| 230 int64_t milliseconds = 0; | 232 int64_t milliseconds = 0; |
| 231 // Ignore result if passing invalid argument and just set exit code to 0. | 233 // Ignore result if passing invalid argument and just set exit code to 0. |
| 232 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &milliseconds); | 234 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &milliseconds); |
| 233 TimerUtils::Sleep(milliseconds); | 235 TimerUtils::Sleep(milliseconds); |
| 234 } | 236 } |
| 235 | 237 |
| 236 | 238 |
| 237 void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) { | 239 void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) { |
| 238 // Ignore result if passing invalid argument and just set exit code to 0. | 240 // Ignore result if passing invalid argument and just set exit code to 0. |
| 239 intptr_t pid = -1; | 241 intptr_t pid = -1; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 int external_length = strlen(system_string); | 304 int external_length = strlen(system_string); |
| 303 uint8_t* buffer = NULL; | 305 uint8_t* buffer = NULL; |
| 304 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 306 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 305 memmove(buffer, system_string, external_length); | 307 memmove(buffer, system_string, external_length); |
| 306 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 308 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 307 Dart_SetReturnValue(args, external_array); | 309 Dart_SetReturnValue(args, external_array); |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace bin | 312 } // namespace bin |
| 311 } // namespace dart | 313 } // namespace dart |
| OLD | NEW |