| 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" |
| 11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
| 12 #include "vm/message.h" | 12 #include "vm/message.h" |
| 13 #include "vm/message_handler.h" | 13 #include "vm/message_handler.h" |
| 14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
| 15 #include "vm/native_arguments.h" | 15 #include "vm/native_arguments.h" |
| 16 #include "vm/object.h" | 16 #include "vm/object.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/port.h" | 18 #include "vm/port.h" |
| 19 #include "vm/service.h" | 19 #include "vm/service.h" |
| 20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 21 #include "vm/thread_pool.h" | 21 #include "vm/thread_pool.h" |
| 22 #include "vm/timeline.h" | 22 #include "vm/timeline.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DECLARE_FLAG(bool, shutdown); | |
| 27 | |
| 28 #define Z (T->zone()) | 26 #define Z (T->zone()) |
| 29 | 27 |
| 30 | 28 |
| 31 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); | 29 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); |
| 32 DEFINE_FLAG(bool, trace_service_pause_events, false, | 30 DEFINE_FLAG(bool, trace_service_pause_events, false, |
| 33 "Trace VM service isolate pause events."); | 31 "Trace VM service isolate pause events."); |
| 34 DEFINE_FLAG(bool, trace_service_verbose, false, | 32 DEFINE_FLAG(bool, trace_service_verbose, false, |
| 35 "Provide extra service tracing information."); | 33 "Provide extra service tracing information."); |
| 36 | 34 |
| 37 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { | 35 static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 monitor_ = new Monitor(); | 453 monitor_ = new Monitor(); |
| 456 ASSERT(monitor_ != NULL); | 454 ASSERT(monitor_ != NULL); |
| 457 // Grab the isolate create callback here to avoid race conditions with tests | 455 // Grab the isolate create callback here to avoid race conditions with tests |
| 458 // that change this after Dart_Initialize returns. | 456 // that change this after Dart_Initialize returns. |
| 459 create_callback_ = Isolate::CreateCallback(); | 457 create_callback_ = Isolate::CreateCallback(); |
| 460 Dart::thread_pool()->Run(new RunServiceTask()); | 458 Dart::thread_pool()->Run(new RunServiceTask()); |
| 461 } | 459 } |
| 462 | 460 |
| 463 | 461 |
| 464 void ServiceIsolate::KillServiceIsolate() { | 462 void ServiceIsolate::KillServiceIsolate() { |
| 465 if (!FLAG_shutdown) { | |
| 466 return; | |
| 467 } | |
| 468 { | 463 { |
| 469 MonitorLocker ml(monitor_); | 464 MonitorLocker ml(monitor_); |
| 470 shutting_down_ = true; | 465 shutting_down_ = true; |
| 471 } | 466 } |
| 472 Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg); | 467 Isolate::KillIfExists(isolate_, Isolate::kInternalKillMsg); |
| 473 { | 468 { |
| 474 MonitorLocker ml(monitor_); | 469 MonitorLocker ml(monitor_); |
| 475 while (shutting_down_) { | 470 while (shutting_down_) { |
| 476 ml.Wait(); | 471 ml.Wait(); |
| 477 } | 472 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 523 } |
| 529 ASSERT(port != ILLEGAL_PORT); | 524 ASSERT(port != ILLEGAL_PORT); |
| 530 ServiceIsolate::SetServicePort(port); | 525 ServiceIsolate::SetServicePort(port); |
| 531 } | 526 } |
| 532 | 527 |
| 533 | 528 |
| 534 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 529 void ServiceIsolate::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 535 } | 530 } |
| 536 | 531 |
| 537 } // namespace dart | 532 } // namespace dart |
| OLD | NEW |