OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
11 | 11 |
12 #include "bin/builtin.h" | 12 #include "bin/builtin.h" |
13 #include "bin/dartutils.h" | 13 #include "bin/dartutils.h" |
14 #include "bin/dbg_connection.h" | 14 #include "bin/dbg_connection.h" |
15 #include "bin/directory.h" | 15 #include "bin/directory.h" |
16 #include "bin/eventhandler.h" | 16 #include "bin/eventhandler.h" |
17 #include "bin/extensions.h" | 17 #include "bin/extensions.h" |
18 #include "bin/file.h" | 18 #include "bin/file.h" |
19 #include "bin/isolate_data.h" | 19 #include "bin/isolate_data.h" |
20 #include "bin/log.h" | 20 #include "bin/log.h" |
21 #include "bin/platform.h" | 21 #include "bin/platform.h" |
22 #include "bin/process.h" | 22 #include "bin/process.h" |
| 23 #include "bin/thread.h" |
23 #include "bin/vmservice_impl.h" | 24 #include "bin/vmservice_impl.h" |
24 #include "platform/globals.h" | 25 #include "platform/globals.h" |
25 #include "platform/hashmap.h" | 26 #include "platform/hashmap.h" |
26 | 27 |
27 namespace dart { | 28 namespace dart { |
28 namespace bin { | 29 namespace bin { |
29 | 30 |
30 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise | 31 // snapshot_buffer points to a snapshot if we link in a snapshot otherwise |
31 // it is initialized to NULL. | 32 // it is initialized to NULL. |
32 extern const uint8_t* snapshot_buffer; | 33 extern const uint8_t* snapshot_buffer; |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 // Will set the VM flags, print them out and then we exit as no | 980 // Will set the VM flags, print them out and then we exit as no |
980 // script was specified on the command line. | 981 // script was specified on the command line. |
981 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 982 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
982 exit(0); | 983 exit(0); |
983 } else { | 984 } else { |
984 PrintUsage(); | 985 PrintUsage(); |
985 exit(kErrorExitCode); | 986 exit(kErrorExitCode); |
986 } | 987 } |
987 } | 988 } |
988 | 989 |
| 990 Thread::InitOnce(); |
| 991 |
989 if (!DartUtils::SetOriginalWorkingDirectory()) { | 992 if (!DartUtils::SetOriginalWorkingDirectory()) { |
990 OSError err; | 993 OSError err; |
991 fprintf(stderr, "Error determining current directory: %s\n", err.message()); | 994 fprintf(stderr, "Error determining current directory: %s\n", err.message()); |
992 fflush(stderr); | 995 fflush(stderr); |
993 exit(kErrorExitCode); | 996 exit(kErrorExitCode); |
994 } | 997 } |
995 | 998 |
996 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 999 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
997 | 1000 |
998 // Initialize the Dart VM. | 1001 // Initialize the Dart VM. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 exit(Process::GlobalExitCode()); | 1182 exit(Process::GlobalExitCode()); |
1180 } | 1183 } |
1181 | 1184 |
1182 } // namespace bin | 1185 } // namespace bin |
1183 } // namespace dart | 1186 } // namespace dart |
1184 | 1187 |
1185 int main(int argc, char** argv) { | 1188 int main(int argc, char** argv) { |
1186 dart::bin::main(argc, argv); | 1189 dart::bin::main(argc, argv); |
1187 UNREACHABLE(); | 1190 UNREACHABLE(); |
1188 } | 1191 } |
OLD | NEW |