OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/service_isolate.h" | 5 #include "vm/service_isolate.h" |
6 | 6 |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/dev_fs.h" | |
11 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
12 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
13 #include "vm/message.h" | 12 #include "vm/message.h" |
14 #include "vm/message_handler.h" | 13 #include "vm/message_handler.h" |
15 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
16 #include "vm/native_arguments.h" | 15 #include "vm/native_arguments.h" |
17 #include "vm/object.h" | 16 #include "vm/object.h" |
18 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
19 #include "vm/port.h" | 18 #include "vm/port.h" |
20 #include "vm/service.h" | 19 #include "vm/service.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 }; | 450 }; |
452 | 451 |
453 | 452 |
454 void ServiceIsolate::Run() { | 453 void ServiceIsolate::Run() { |
455 ASSERT(monitor_ == NULL); | 454 ASSERT(monitor_ == NULL); |
456 monitor_ = new Monitor(); | 455 monitor_ = new Monitor(); |
457 ASSERT(monitor_ != NULL); | 456 ASSERT(monitor_ != NULL); |
458 // Grab the isolate create callback here to avoid race conditions with tests | 457 // Grab the isolate create callback here to avoid race conditions with tests |
459 // that change this after Dart_Initialize returns. | 458 // that change this after Dart_Initialize returns. |
460 create_callback_ = Isolate::CreateCallback(); | 459 create_callback_ = Isolate::CreateCallback(); |
461 if (FLAG_support_service) { | |
462 DevFS::Init(); | |
463 } | |
464 Dart::thread_pool()->Run(new RunServiceTask()); | 460 Dart::thread_pool()->Run(new RunServiceTask()); |
465 } | 461 } |
466 | 462 |
467 | 463 |
468 void ServiceIsolate::KillServiceIsolate() { | 464 void ServiceIsolate::KillServiceIsolate() { |
469 if (!FLAG_shutdown) { | 465 if (!FLAG_shutdown) { |
470 return; | 466 return; |
471 } | 467 } |
472 { | 468 { |
473 MonitorLocker ml(monitor_); | 469 MonitorLocker ml(monitor_); |
(...skipping 28 matching lines...) Expand all Loading... |
502 // the VMService object and set up its shutdown handler in the service | 498 // the VMService object and set up its shutdown handler in the service |
503 // isolate's main() function, this case will no longer be possible and | 499 // isolate's main() function, this case will no longer be possible and |
504 // can be removed. | 500 // can be removed. |
505 KillServiceIsolate(); | 501 KillServiceIsolate(); |
506 } | 502 } |
507 } | 503 } |
508 if (server_address_ != NULL) { | 504 if (server_address_ != NULL) { |
509 free(server_address_); | 505 free(server_address_); |
510 server_address_ = NULL; | 506 server_address_ = NULL; |
511 } | 507 } |
512 if (FLAG_support_service) { | |
513 DevFS::Cleanup(); | |
514 } | |
515 } | 508 } |
516 | 509 |
517 | 510 |
518 void ServiceIsolate::BootVmServiceLibrary() { | 511 void ServiceIsolate::BootVmServiceLibrary() { |
519 Thread* thread = Thread::Current(); | 512 Thread* thread = Thread::Current(); |
520 const Library& vmservice_library = | 513 const Library& vmservice_library = |
521 Library::Handle(Library::LookupLibrary(thread, Symbols::DartVMService())); | 514 Library::Handle(Library::LookupLibrary(thread, Symbols::DartVMService())); |
522 ASSERT(!vmservice_library.IsNull()); | 515 ASSERT(!vmservice_library.IsNull()); |
523 const String& boot_function_name = String::Handle(String::New("boot")); | 516 const String& boot_function_name = String::Handle(String::New("boot")); |
524 const Function& boot_function = | 517 const Function& boot_function = |
(...skipping 10 matching lines...) Expand all Loading... |
535 } | 528 } |
536 ASSERT(port != ILLEGAL_PORT); | 529 ASSERT(port != ILLEGAL_PORT); |
537 ServiceIsolate::SetServicePort(port); | 530 ServiceIsolate::SetServicePort(port); |
538 } | 531 } |
539 | 532 |
540 | 533 |
541 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 534 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
542 } | 535 } |
543 | 536 |
544 } // namespace dart | 537 } // namespace dart |
OLD | NEW |