Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: runtime/bin/main.cc

Issue 237113002: SIGQUIT toggles VM service HTTP server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/vmservice/server.dart » ('j') | runtime/bin/vmservice/server.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Global flag that is used to indicate that we want to compile all the 59 // Global flag that is used to indicate that we want to compile all the
60 // dart functions and not run anything. 60 // dart functions and not run anything.
61 static bool has_compile_all = false; 61 static bool has_compile_all = false;
62 62
63 // Global flag that is used to indicate that we want to print the source code 63 // Global flag that is used to indicate that we want to print the source code
64 // for script that is being run. 64 // for script that is being run.
65 static bool has_print_script = false; 65 static bool has_print_script = false;
66 66
67 67
68 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1";
69 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181;
68 // VM Service options. 70 // VM Service options.
69 static bool start_vm_service = false; 71 static bool start_vm_service = true;
70 static const char *vm_service_server_ip = NULL; 72 static const char* vm_service_server_ip = DEFAULT_VM_SERVICE_SERVER_IP;
71 static int vm_service_server_port = -1; 73 // The 0 port is a magic value which results in the first available port
72 static const char *DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; 74 // being allocated.
73 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 8181; 75 static int vm_service_server_port = 0;
74 76
75 // The environment provided through the command line using -D options. 77 // The environment provided through the command line using -D options.
76 static dart::HashMap* environment = NULL; 78 static dart::HashMap* environment = NULL;
77 79
78 static bool IsValidFlag(const char* name, 80 static bool IsValidFlag(const char* name,
79 const char* prefix, 81 const char* prefix,
80 intptr_t prefix_length) { 82 intptr_t prefix_length) {
81 intptr_t name_length = strlen(name); 83 intptr_t name_length = strlen(name);
82 return ((name_length > prefix_length) && 84 return ((name_length > prefix_length) &&
83 (strncmp(name, prefix, prefix_length) == 0)); 85 (strncmp(name, prefix, prefix_length) == 0));
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 978
977 // Start event handler. 979 // Start event handler.
978 EventHandler::Start(); 980 EventHandler::Start();
979 981
980 ASSERT(Dart_CurrentIsolate() == NULL); 982 ASSERT(Dart_CurrentIsolate() == NULL);
981 // Start the VM service isolate, if necessary. 983 // Start the VM service isolate, if necessary.
982 if (start_vm_service) { 984 if (start_vm_service) {
983 if (!start_debugger) { 985 if (!start_debugger) {
984 DebuggerConnectionHandler::InitForVmService(); 986 DebuggerConnectionHandler::InitForVmService();
985 } 987 }
986 ASSERT(vm_service_server_ip != NULL && vm_service_server_port >= 0); 988 bool r = VmService::Start(vm_service_server_ip, vm_service_server_port);
987 bool r = VmService::Start(vm_service_server_ip , vm_service_server_port);
988 if (!r) { 989 if (!r) {
989 Log::PrintErr("Could not start VM Service isolate %s\n", 990 Log::PrintErr("Could not start VM Service isolate %s\n",
990 VmService::GetErrorMessage()); 991 VmService::GetErrorMessage());
991 } 992 }
992 Dart_RegisterIsolateServiceRequestCallback( 993 Dart_RegisterIsolateServiceRequestCallback(
993 "io", &ServiceRequestHandler, NULL); 994 "io", &ServiceRequestHandler, NULL);
994 } 995 }
995 ASSERT(Dart_CurrentIsolate() == NULL); 996 ASSERT(Dart_CurrentIsolate() == NULL);
996 997
997 // Call CreateIsolateAndSetup which creates an isolate and loads up 998 // Call CreateIsolateAndSetup which creates an isolate and loads up
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 exit(Process::GlobalExitCode()); 1137 exit(Process::GlobalExitCode());
1137 } 1138 }
1138 1139
1139 } // namespace bin 1140 } // namespace bin
1140 } // namespace dart 1141 } // namespace dart
1141 1142
1142 int main(int argc, char** argv) { 1143 int main(int argc, char** argv) {
1143 dart::bin::main(argc, argv); 1144 dart::bin::main(argc, argv);
1144 UNREACHABLE(); 1145 UNREACHABLE();
1145 } 1146 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/vmservice/server.dart » ('j') | runtime/bin/vmservice/server.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698