| 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/process.h" | 7 #include "bin/process.h" |
| 8 #include "bin/socket.h" | 8 #include "bin/socket.h" |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| 11 | 11 |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 namespace bin { | 14 namespace bin { |
| 15 | 15 |
| 16 static const int kProcessIdNativeField = 0; | 16 static const int kProcessIdNativeField = 0; |
| 17 | 17 |
| 18 int Process::global_exit_code_ = 0; | 18 int Process::global_exit_code_ = 0; |
| 19 dart::Mutex Process::global_exit_code_mutex_; | 19 dart::Mutex* Process::global_exit_code_mutex_ = new dart::Mutex(); |
| 20 | 20 |
| 21 // Extract an array of C strings from a list of Dart strings. | 21 // Extract an array of C strings from a list of Dart strings. |
| 22 static char** ExtractCStringList(Dart_Handle strings, | 22 static char** ExtractCStringList(Dart_Handle strings, |
| 23 Dart_Handle status_handle, | 23 Dart_Handle status_handle, |
| 24 const char* error_msg, | 24 const char* error_msg, |
| 25 intptr_t* length) { | 25 intptr_t* length) { |
| 26 static const intptr_t kMaxArgumentListLength = 1024 * 1024; | 26 static const intptr_t kMaxArgumentListLength = 1024 * 1024; |
| 27 ASSERT(Dart_IsList(strings)); | 27 ASSERT(Dart_IsList(strings)); |
| 28 intptr_t len = 0; | 28 intptr_t len = 0; |
| 29 Dart_Handle result = Dart_ListLength(strings, &len); | 29 Dart_Handle result = Dart_ListLength(strings, &len); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 uint8_t* buffer = NULL; | 260 uint8_t* buffer = NULL; |
| 261 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 261 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 262 memmove(buffer, system_string, external_length); | 262 memmove(buffer, system_string, external_length); |
| 263 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 263 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 264 Dart_SetReturnValue(args, external_array); | 264 Dart_SetReturnValue(args, external_array); |
| 265 Dart_ExitScope(); | 265 Dart_ExitScope(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace bin | 268 } // namespace bin |
| 269 } // namespace dart | 269 } // namespace dart |
| OLD | NEW |