| 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 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 Dart_Handle process = Dart_GetNativeArgument(args, 0); | 236 Dart_Handle process = Dart_GetNativeArgument(args, 0); |
| 237 if (Dart_IsNull(process)) { | 237 if (Dart_IsNull(process)) { |
| 238 pid = Process::CurrentProcessId(); | 238 pid = Process::CurrentProcessId(); |
| 239 } else { | 239 } else { |
| 240 Process::GetProcessIdNativeField(process, &pid); | 240 Process::GetProcessIdNativeField(process, &pid); |
| 241 } | 241 } |
| 242 Dart_SetReturnValue(args, Dart_NewInteger(pid)); | 242 Dart_SetReturnValue(args, Dart_NewInteger(pid)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 void FUNCTION_NAME(Process_SetSignalHandler)(Dart_NativeArguments args) { |
| 247 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 248 intptr_t id = Process::SetSignalHandler(signal); |
| 249 if (id == -1) { |
| 250 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
| 251 } else { |
| 252 Dart_SetReturnValue(args, Dart_NewInteger(id)); |
| 253 } |
| 254 } |
| 255 |
| 256 |
| 257 void FUNCTION_NAME(Process_ClearSignalHandler)(Dart_NativeArguments args) { |
| 258 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); |
| 259 Process::ClearSignalHandler(signal); |
| 260 } |
| 261 |
| 262 |
| 246 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, | 263 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, |
| 247 intptr_t* pid) { | 264 intptr_t* pid) { |
| 248 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); | 265 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); |
| 249 } | 266 } |
| 250 | 267 |
| 251 | 268 |
| 252 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, | 269 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, |
| 253 intptr_t pid) { | 270 intptr_t pid) { |
| 254 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); | 271 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); |
| 255 } | 272 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 281 int external_length = strlen(system_string); | 298 int external_length = strlen(system_string); |
| 282 uint8_t* buffer = NULL; | 299 uint8_t* buffer = NULL; |
| 283 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 300 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 284 memmove(buffer, system_string, external_length); | 301 memmove(buffer, system_string, external_length); |
| 285 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 302 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 286 Dart_SetReturnValue(args, external_array); | 303 Dart_SetReturnValue(args, external_array); |
| 287 } | 304 } |
| 288 | 305 |
| 289 } // namespace bin | 306 } // namespace bin |
| 290 } // namespace dart | 307 } // namespace dart |
| OLD | NEW |