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

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

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years, 3 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
« no previous file with comments | « runtime/bin/vmservice/vmservice_io.dart ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/vmservice_impl.h" 5 #include "bin/vmservice_impl.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 } 153 }
154 return NULL; 154 return NULL;
155 } 155 }
156 156
157 157
158 const char* VmService::error_msg_ = NULL; 158 const char* VmService::error_msg_ = NULL;
159 char VmService::server_ip_[kServerIpStringBufferSize]; 159 char VmService::server_ip_[kServerIpStringBufferSize];
160 intptr_t VmService::server_port_ = 0; 160 intptr_t VmService::server_port_ = 0;
161 161
162
162 bool VmService::Setup(const char* server_ip, intptr_t server_port) { 163 bool VmService::Setup(const char* server_ip, intptr_t server_port) {
163 Dart_Isolate isolate = Dart_CurrentIsolate(); 164 Dart_Isolate isolate = Dart_CurrentIsolate();
164 ASSERT(isolate != NULL); 165 ASSERT(isolate != NULL);
165 SetServerIPAndPort("", 0); 166 SetServerIPAndPort("", 0);
166 167
167 Dart_Handle result; 168 Dart_Handle result;
168 169
169 Dart_Handle builtin_lib = 170 Dart_Handle builtin_lib =
170 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 171 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
171 SHUTDOWN_ON_ERROR(builtin_lib); 172 SHUTDOWN_ON_ERROR(builtin_lib);
(...skipping 24 matching lines...) Expand all
196 error_msg_ = "Invalid isolate state - Unable to make it runnable."; 197 error_msg_ = "Invalid isolate state - Unable to make it runnable.";
197 return false; 198 return false;
198 } 199 }
199 Dart_EnterIsolate(isolate); 200 Dart_EnterIsolate(isolate);
200 Dart_EnterScope(); 201 Dart_EnterScope();
201 202
202 library = Dart_RootLibrary(); 203 library = Dart_RootLibrary();
203 SHUTDOWN_ON_ERROR(library); 204 SHUTDOWN_ON_ERROR(library);
204 205
205 // Set HTTP server state. 206 // Set HTTP server state.
206 DartUtils::SetStringField(library, "_ip", server_ip); 207 result = DartUtils::SetStringField(library, "_ip", server_ip);
208 SHUTDOWN_ON_ERROR(result);
207 // If we have a port specified, start the server immediately. 209 // If we have a port specified, start the server immediately.
208 bool auto_start = server_port >= 0; 210 bool auto_start = server_port >= 0;
209 if (server_port < 0) { 211 if (server_port < 0) {
210 // Adjust server_port to port 0 which will result in the first available 212 // Adjust server_port to port 0 which will result in the first available
211 // port when the HTTP server is started. 213 // port when the HTTP server is started.
212 server_port = 0; 214 server_port = 0;
213 } 215 }
214 DartUtils::SetIntegerField(library, "_port", server_port); 216 result = DartUtils::SetIntegerField(library, "_port", server_port);
217 SHUTDOWN_ON_ERROR(result);
215 result = Dart_SetField(library, 218 result = Dart_SetField(library,
216 DartUtils::NewString("_autoStart"), 219 DartUtils::NewString("_autoStart"),
217 Dart_NewBoolean(auto_start)); 220 Dart_NewBoolean(auto_start));
218 SHUTDOWN_ON_ERROR(result); 221 SHUTDOWN_ON_ERROR(result);
219 222
220 // Are we running on Windows? 223 // Are we running on Windows?
221 #if defined(TARGET_OS_WINDOWS) 224 #if defined(TARGET_OS_WINDOWS)
222 Dart_Handle is_windows = Dart_True(); 225 Dart_Handle is_windows = Dart_True();
223 #else 226 #else
224 Dart_Handle is_windows = Dart_False(); 227 Dart_Handle is_windows = Dart_False();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 Dart_Handle source = GetSource(url_string); 381 Dart_Handle source = GetSource(url_string);
379 if (Dart_IsError(source)) { 382 if (Dart_IsError(source)) {
380 return source; 383 return source;
381 } 384 }
382 return Dart_LoadSource(library, url, source, 0, 0); 385 return Dart_LoadSource(library, url, source, 0, 0);
383 } 386 }
384 387
385 388
386 } // namespace bin 389 } // namespace bin
387 } // namespace dart 390 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/vmservice_io.dart ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698