| 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" |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 fprintf(stderr, "Error determining current directory: %s\n", err.message()); | 940 fprintf(stderr, "Error determining current directory: %s\n", err.message()); |
| 941 fflush(stderr); | 941 fflush(stderr); |
| 942 exit(kErrorExitCode); | 942 exit(kErrorExitCode); |
| 943 } | 943 } |
| 944 | 944 |
| 945 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 945 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 946 | 946 |
| 947 // Start event handler. | 947 // Start event handler. |
| 948 EventHandler::Start(); | 948 EventHandler::Start(); |
| 949 | 949 |
| 950 // Initialize the Dart VM. | |
| 951 if (!Dart_Initialize(CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, | |
| 952 DartUtils::OpenFile, | |
| 953 DartUtils::ReadFile, | |
| 954 DartUtils::WriteFile, | |
| 955 DartUtils::CloseFile, | |
| 956 DartUtils::EntropySource)) { | |
| 957 fprintf(stderr, "%s", "VM initialization failed\n"); | |
| 958 fflush(stderr); | |
| 959 exit(kErrorExitCode); | |
| 960 } | |
| 961 | |
| 962 | |
| 963 | |
| 964 // Start the debugger wire protocol handler if necessary. | 950 // Start the debugger wire protocol handler if necessary. |
| 965 if (start_debugger) { | 951 if (start_debugger) { |
| 966 ASSERT(debug_port >= 0); | 952 ASSERT(debug_port >= 0); |
| 967 bool print_msg = verbose_debug_seen || (debug_port == 0); | 953 bool print_msg = verbose_debug_seen || (debug_port == 0); |
| 968 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); | 954 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); |
| 969 if (print_msg) { | 955 if (print_msg) { |
| 970 Log::Print("Debugger listening on port %d\n", debug_port); | 956 Log::Print("Debugger listening on port %d\n", debug_port); |
| 971 } | 957 } |
| 972 } else { | 958 } else { |
| 973 DebuggerConnectionHandler::InitForVmService(); | 959 DebuggerConnectionHandler::InitForVmService(); |
| 974 } | 960 } |
| 975 | 961 |
| 962 // Initialize the Dart VM. |
| 963 if (!Dart_Initialize(CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, |
| 964 DartUtils::OpenFile, |
| 965 DartUtils::ReadFile, |
| 966 DartUtils::WriteFile, |
| 967 DartUtils::CloseFile, |
| 968 DartUtils::EntropySource)) { |
| 969 fprintf(stderr, "%s", "VM initialization failed\n"); |
| 970 fflush(stderr); |
| 971 exit(kErrorExitCode); |
| 972 } |
| 973 |
| 976 Dart_RegisterIsolateServiceRequestCallback( | 974 Dart_RegisterIsolateServiceRequestCallback( |
| 977 "io", &ServiceRequestHandler, NULL); | 975 "io", &ServiceRequestHandler, NULL); |
| 978 | 976 |
| 979 // Call CreateIsolateAndSetup which creates an isolate and loads up | 977 // Call CreateIsolateAndSetup which creates an isolate and loads up |
| 980 // the specified application script. | 978 // the specified application script. |
| 981 char* error = NULL; | 979 char* error = NULL; |
| 982 int exit_code = 0; | 980 int exit_code = 0; |
| 983 char* isolate_name = BuildIsolateName(script_name, "main"); | 981 char* isolate_name = BuildIsolateName(script_name, "main"); |
| 984 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, | 982 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, |
| 985 "main", | 983 "main", |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 exit(Process::GlobalExitCode()); | 1112 exit(Process::GlobalExitCode()); |
| 1115 } | 1113 } |
| 1116 | 1114 |
| 1117 } // namespace bin | 1115 } // namespace bin |
| 1118 } // namespace dart | 1116 } // namespace dart |
| 1119 | 1117 |
| 1120 int main(int argc, char** argv) { | 1118 int main(int argc, char** argv) { |
| 1121 dart::bin::main(argc, argv); | 1119 dart::bin::main(argc, argv); |
| 1122 UNREACHABLE(); | 1120 UNREACHABLE(); |
| 1123 } | 1121 } |
| OLD | NEW |