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/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 | 96 |
97 const char* ServiceIsolate::kName = "vm-service"; | 97 const char* ServiceIsolate::kName = "vm-service"; |
98 Isolate* ServiceIsolate::isolate_ = NULL; | 98 Isolate* ServiceIsolate::isolate_ = NULL; |
99 Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT; | 99 Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT; |
100 Dart_Port ServiceIsolate::load_port_ = ILLEGAL_PORT; | 100 Dart_Port ServiceIsolate::load_port_ = ILLEGAL_PORT; |
101 Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT; | 101 Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT; |
102 Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL; | 102 Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL; |
103 uint8_t* ServiceIsolate::exit_message_ = NULL; | 103 uint8_t* ServiceIsolate::exit_message_ = NULL; |
104 intptr_t ServiceIsolate::exit_message_length_ = 0; | 104 intptr_t ServiceIsolate::exit_message_length_ = 0; |
105 Monitor* ServiceIsolate::monitor_ = NULL; | 105 Monitor* ServiceIsolate::monitor_ = new Monitor(); |
106 bool ServiceIsolate::initializing_ = true; | 106 bool ServiceIsolate::initializing_ = true; |
107 bool ServiceIsolate::shutting_down_ = false; | 107 bool ServiceIsolate::shutting_down_ = false; |
108 char* ServiceIsolate::server_address_ = NULL; | 108 char* ServiceIsolate::server_address_ = NULL; |
109 | 109 |
110 void ServiceIsolate::RequestServerInfo(const SendPort& sp) { | 110 void ServiceIsolate::RequestServerInfo(const SendPort& sp) { |
111 const Array& message = Array::Handle(MakeServerControlMessage( | 111 const Array& message = Array::Handle(MakeServerControlMessage( |
112 sp, VM_SERVICE_SERVER_INFO_MESSAGE_ID, false /* ignored */)); | 112 sp, VM_SERVICE_SERVER_INFO_MESSAGE_ID, false /* ignored */)); |
113 ASSERT(!message.IsNull()); | 113 ASSERT(!message.IsNull()); |
114 uint8_t* data = NULL; | 114 uint8_t* data = NULL; |
115 MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false); | 115 MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 476 } |
477 ASSERT(result.IsReceivePort()); | 477 ASSERT(result.IsReceivePort()); |
478 const ReceivePort& rp = ReceivePort::Cast(result); | 478 const ReceivePort& rp = ReceivePort::Cast(result); |
479 ServiceIsolate::SetLoadPort(rp.Id()); | 479 ServiceIsolate::SetLoadPort(rp.Id()); |
480 return false; | 480 return false; |
481 } | 481 } |
482 }; | 482 }; |
483 | 483 |
484 | 484 |
485 void ServiceIsolate::Run() { | 485 void ServiceIsolate::Run() { |
486 ASSERT(monitor_ == NULL); | |
487 monitor_ = new Monitor(); | |
488 ASSERT(monitor_ != NULL); | |
489 // Grab the isolate create callback here to avoid race conditions with tests | 486 // Grab the isolate create callback here to avoid race conditions with tests |
490 // that change this after Dart_Initialize returns. | 487 // that change this after Dart_Initialize returns. |
491 create_callback_ = Isolate::CreateCallback(); | 488 create_callback_ = Isolate::CreateCallback(); |
492 Dart::thread_pool()->Run(new RunServiceTask()); | 489 Dart::thread_pool()->Run(new RunServiceTask()); |
493 } | 490 } |
494 | 491 |
495 | 492 |
496 void ServiceIsolate::KillServiceIsolate() { | 493 void ServiceIsolate::KillServiceIsolate() { |
497 { | 494 { |
498 MonitorLocker ml(monitor_); | 495 MonitorLocker ml(monitor_); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 port = ReceivePort::Cast(result).Id(); | 554 port = ReceivePort::Cast(result).Id(); |
558 } | 555 } |
559 ASSERT(port != ILLEGAL_PORT); | 556 ASSERT(port != ILLEGAL_PORT); |
560 ServiceIsolate::SetServicePort(port); | 557 ServiceIsolate::SetServicePort(port); |
561 } | 558 } |
562 | 559 |
563 | 560 |
564 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) {} | 561 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) {} |
565 | 562 |
566 } // namespace dart | 563 } // namespace dart |
OLD | NEW |