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 #include "bin/utils.h" |
11 | 11 |
12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 namespace bin { | 15 namespace bin { |
16 | 16 |
17 static const int kProcessIdNativeField = 0; | 17 static const int kProcessIdNativeField = 0; |
18 | 18 |
19 int Process::global_exit_code_ = 0; | 19 int Process::global_exit_code_ = 0; |
20 dart::Mutex* Process::global_exit_code_mutex_ = new dart::Mutex(); | 20 Mutex* Process::global_exit_code_mutex_ = new Mutex(); |
21 | 21 |
22 // Extract an array of C strings from a list of Dart strings. | 22 // Extract an array of C strings from a list of Dart strings. |
23 static char** ExtractCStringList(Dart_Handle strings, | 23 static char** ExtractCStringList(Dart_Handle strings, |
24 Dart_Handle status_handle, | 24 Dart_Handle status_handle, |
25 const char* error_msg, | 25 const char* error_msg, |
26 intptr_t* length) { | 26 intptr_t* length) { |
27 static const intptr_t kMaxArgumentListLength = 1024 * 1024; | 27 static const intptr_t kMaxArgumentListLength = 1024 * 1024; |
28 ASSERT(Dart_IsList(strings)); | 28 ASSERT(Dart_IsList(strings)); |
29 intptr_t len = 0; | 29 intptr_t len = 0; |
30 Dart_Handle result = Dart_ListLength(strings, &len); | 30 Dart_Handle result = Dart_ListLength(strings, &len); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 int external_length = strlen(system_string); | 304 int external_length = strlen(system_string); |
305 uint8_t* buffer = NULL; | 305 uint8_t* buffer = NULL; |
306 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 306 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
307 memmove(buffer, system_string, external_length); | 307 memmove(buffer, system_string, external_length); |
308 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 308 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
309 Dart_SetReturnValue(args, external_array); | 309 Dart_SetReturnValue(args, external_array); |
310 } | 310 } |
311 | 311 |
312 } // namespace bin | 312 } // namespace bin |
313 } // namespace dart | 313 } // namespace dart |
OLD | NEW |