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