| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifdef FLETCH_ENABLE_NATIVE_PROCESSES | 5 #ifdef DARTINO_ENABLE_NATIVE_PROCESSES |
| 6 | 6 |
| 7 #if defined(FLETCH_TARGET_OS_WIN) | 7 #if defined(DARTINO_TARGET_OS_WIN) |
| 8 | 8 |
| 9 #include "src/vm/natives.h" | 9 #include "src/vm/natives.h" |
| 10 #include "src/vm/object.h" | 10 #include "src/vm/object.h" |
| 11 #include "src/vm/process.h" | 11 #include "src/vm/process.h" |
| 12 #include "src/shared/assert.h" | 12 #include "src/shared/assert.h" |
| 13 | 13 |
| 14 namespace fletch { | 14 namespace dartino { |
| 15 | 15 |
| 16 BEGIN_NATIVE(NativeProcessSpawnDetached) { | 16 BEGIN_NATIVE(NativeProcessSpawnDetached) { |
| 17 word array = AsForeignWord(arguments[0]); | 17 word array = AsForeignWord(arguments[0]); |
| 18 if (array == 0) return Failure::illegal_state(); | 18 if (array == 0) return Failure::illegal_state(); |
| 19 Object* result = process->NewInteger(-1); | 19 Object* result = process->NewInteger(-1); |
| 20 if (result->IsRetryAfterGCFailure()) return result; | 20 if (result->IsRetryAfterGCFailure()) return result; |
| 21 char** args = reinterpret_cast<char**>(array); | 21 char** args = reinterpret_cast<char**>(array); |
| 22 char* path = args[0]; | 22 char* path = args[0]; |
| 23 if (path == NULL) return Failure::illegal_state(); | 23 if (path == NULL) return Failure::illegal_state(); |
| 24 int argc = 0; | 24 int argc = 0; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return result; | 98 return result; |
| 99 } | 99 } |
| 100 // TODO(herhut): Consider using WaitForInputIdle here. | 100 // TODO(herhut): Consider using WaitForInputIdle here. |
| 101 CloseHandle(process_info.hProcess); | 101 CloseHandle(process_info.hProcess); |
| 102 CloseHandle(process_info.hThread); | 102 CloseHandle(process_info.hThread); |
| 103 LargeInteger::cast(result)->set_value(process_info.dwProcessId); | 103 LargeInteger::cast(result)->set_value(process_info.dwProcessId); |
| 104 return result; | 104 return result; |
| 105 } | 105 } |
| 106 END_NATIVE() | 106 END_NATIVE() |
| 107 | 107 |
| 108 } // namespace fletch | 108 } // namespace dartino |
| 109 | 109 |
| 110 #endif // defined(FLETCH_TARGET_OS_WIN) | 110 #endif // defined(DARTINO_TARGET_OS_WIN) |
| 111 | 111 |
| 112 #endif // !FLETCH_ENABLE_NATIVE_PROCESSES | 112 #endif // !DARTINO_ENABLE_NATIVE_PROCESSES |
| OLD | NEW |