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 | 22 |
23 namespace dart { | 23 namespace dart { |
24 | 24 |
| 25 DECLARE_FLAG(bool, shutdown); |
| 26 |
25 #define Z (T->zone()) | 27 #define Z (T->zone()) |
26 | 28 |
27 | 29 |
28 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); | 30 DEFINE_FLAG(bool, trace_service, false, "Trace VM service requests."); |
29 DEFINE_FLAG(bool, trace_service_pause_events, false, | 31 DEFINE_FLAG(bool, trace_service_pause_events, false, |
30 "Trace VM service isolate pause events."); | 32 "Trace VM service isolate pause events."); |
31 | 33 |
32 struct ResourcesEntry { | 34 struct ResourcesEntry { |
33 const char* path_; | 35 const char* path_; |
34 const char* resource_; | 36 const char* resource_; |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 monitor_ = new Monitor(); | 758 monitor_ = new Monitor(); |
757 ASSERT(monitor_ != NULL); | 759 ASSERT(monitor_ != NULL); |
758 // Grab the isolate create callback here to avoid race conditions with tests | 760 // Grab the isolate create callback here to avoid race conditions with tests |
759 // that change this after Dart_Initialize returns. | 761 // that change this after Dart_Initialize returns. |
760 create_callback_ = Isolate::CreateCallback(); | 762 create_callback_ = Isolate::CreateCallback(); |
761 Dart::thread_pool()->Run(new RunServiceTask()); | 763 Dart::thread_pool()->Run(new RunServiceTask()); |
762 } | 764 } |
763 | 765 |
764 | 766 |
765 void ServiceIsolate::KillServiceIsolate() { | 767 void ServiceIsolate::KillServiceIsolate() { |
| 768 if (!FLAG_shutdown) { |
| 769 return; |
| 770 } |
766 { | 771 { |
767 MonitorLocker ml(monitor_); | 772 MonitorLocker ml(monitor_); |
768 shutting_down_ = true; | 773 shutting_down_ = true; |
769 } | 774 } |
770 Isolate::KillIfExists(isolate_); | 775 Isolate::KillIfExists(isolate_); |
771 { | 776 { |
772 MonitorLocker ml(monitor_); | 777 MonitorLocker ml(monitor_); |
773 while (shutting_down_) { | 778 while (shutting_down_) { |
774 ml.Wait(); | 779 ml.Wait(); |
775 } | 780 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 return result; | 847 return result; |
843 } | 848 } |
844 Dart_Handle source = GetSource(url_string); | 849 Dart_Handle source = GetSource(url_string); |
845 if (Dart_IsError(source)) { | 850 if (Dart_IsError(source)) { |
846 return source; | 851 return source; |
847 } | 852 } |
848 return Dart_LoadSource(library, url, source, 0, 0); | 853 return Dart_LoadSource(library, url, source, 0, 0); |
849 } | 854 } |
850 | 855 |
851 } // namespace dart | 856 } // namespace dart |
OLD | NEW |