| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (Dart_IsError(result)) return ServiceRequestError(result); | 865 if (Dart_IsError(result)) return ServiceRequestError(result); |
| 866 const char *json; | 866 const char *json; |
| 867 result = Dart_StringToCString(result, &json); | 867 result = Dart_StringToCString(result, &json); |
| 868 if (Dart_IsError(result)) return ServiceRequestError(result); | 868 if (Dart_IsError(result)) return ServiceRequestError(result); |
| 869 return strdup(json); | 869 return strdup(json); |
| 870 } | 870 } |
| 871 | 871 |
| 872 | 872 |
| 873 void main(int argc, char** argv) { | 873 void main(int argc, char** argv) { |
| 874 char* script_name; | 874 char* script_name; |
| 875 CommandLineOptions vm_options(argc); | 875 const int EXTRA_VM_ARGUMENTS = 2; |
| 876 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); |
| 876 CommandLineOptions dart_options(argc); | 877 CommandLineOptions dart_options(argc); |
| 877 bool print_flags_seen = false; | 878 bool print_flags_seen = false; |
| 878 bool verbose_debug_seen = false; | 879 bool verbose_debug_seen = false; |
| 879 | 880 |
| 880 vm_options.AddArgument("--no_write_protect_code"); | 881 vm_options.AddArgument("--no_write_protect_code"); |
| 881 // Perform platform specific initialization. | 882 // Perform platform specific initialization. |
| 882 if (!Platform::Initialize()) { | 883 if (!Platform::Initialize()) { |
| 883 Log::PrintErr("Initialization failed\n"); | 884 Log::PrintErr("Initialization failed\n"); |
| 884 } | 885 } |
| 885 | 886 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 914 | 915 |
| 915 Thread::InitOnce(); | 916 Thread::InitOnce(); |
| 916 | 917 |
| 917 if (!DartUtils::SetOriginalWorkingDirectory()) { | 918 if (!DartUtils::SetOriginalWorkingDirectory()) { |
| 918 OSError err; | 919 OSError err; |
| 919 fprintf(stderr, "Error determining current directory: %s\n", err.message()); | 920 fprintf(stderr, "Error determining current directory: %s\n", err.message()); |
| 920 fflush(stderr); | 921 fflush(stderr); |
| 921 exit(kErrorExitCode); | 922 exit(kErrorExitCode); |
| 922 } | 923 } |
| 923 | 924 |
| 925 if (generate_script_snapshot) { |
| 926 vm_options.AddArgument("--load_deferred_eagerly"); |
| 927 } |
| 928 |
| 924 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 929 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 925 | 930 |
| 926 // Start event handler. | 931 // Start event handler. |
| 927 EventHandler::Start(); | 932 EventHandler::Start(); |
| 928 | 933 |
| 929 // Start the debugger wire protocol handler if necessary. | 934 // Start the debugger wire protocol handler if necessary. |
| 930 if (start_debugger) { | 935 if (start_debugger) { |
| 931 ASSERT(debug_port >= 0); | 936 ASSERT(debug_port >= 0); |
| 932 bool print_msg = verbose_debug_seen || (debug_port == 0); | 937 bool print_msg = verbose_debug_seen || (debug_port == 0); |
| 933 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); | 938 debug_port = DebuggerConnectionHandler::StartHandler(debug_ip, debug_port); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 exit(Process::GlobalExitCode()); | 1094 exit(Process::GlobalExitCode()); |
| 1090 } | 1095 } |
| 1091 | 1096 |
| 1092 } // namespace bin | 1097 } // namespace bin |
| 1093 } // namespace dart | 1098 } // namespace dart |
| 1094 | 1099 |
| 1095 int main(int argc, char** argv) { | 1100 int main(int argc, char** argv) { |
| 1096 dart::bin::main(argc, argv); | 1101 dart::bin::main(argc, argv); |
| 1097 UNREACHABLE(); | 1102 UNREACHABLE(); |
| 1098 } | 1103 } |
| OLD | NEW |