OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef VM_ISOLATE_H_ | 5 #ifndef VM_ISOLATE_H_ |
6 #define VM_ISOLATE_H_ | 6 #define VM_ISOLATE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 kKillMsg = 4, | 123 kKillMsg = 4, |
124 kAddExitMsg = 5, | 124 kAddExitMsg = 5, |
125 kDelExitMsg = 6, | 125 kDelExitMsg = 6, |
126 kAddErrorMsg = 7, | 126 kAddErrorMsg = 7, |
127 kDelErrorMsg = 8, | 127 kDelErrorMsg = 8, |
128 kErrorFatalMsg = 9, | 128 kErrorFatalMsg = 9, |
129 | 129 |
130 // Internal message ids. | 130 // Internal message ids. |
131 kInterruptMsg = 10, // Break in the debugger. | 131 kInterruptMsg = 10, // Break in the debugger. |
132 kInternalKillMsg = 11, // Like kill, but does not run exit listeners, etc. | 132 kInternalKillMsg = 11, // Like kill, but does not run exit listeners, etc. |
| 133 kVMRestartMsg = 12, // Sent to isolates when vm is restarting. |
133 }; | 134 }; |
134 // The different Isolate API message priorities for ping and kill messages. | 135 // The different Isolate API message priorities for ping and kill messages. |
135 enum LibMsgPriority { | 136 enum LibMsgPriority { |
136 kImmediateAction = 0, | 137 kImmediateAction = 0, |
137 kBeforeNextEventAction = 1, | 138 kBeforeNextEventAction = 1, |
138 kAsEventAction = 2 | 139 kAsEventAction = 2 |
139 }; | 140 }; |
140 | 141 |
141 ~Isolate(); | 142 ~Isolate(); |
142 | 143 |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 ASSERT(Thread::Current() == mutator_thread_); | 760 ASSERT(Thread::Current() == mutator_thread_); |
760 return mutator_thread_->zone(); | 761 return mutator_thread_->zone(); |
761 } | 762 } |
762 void set_current_zone(Zone* zone) { | 763 void set_current_zone(Zone* zone) { |
763 ASSERT(Thread::Current() == mutator_thread_); | 764 ASSERT(Thread::Current() == mutator_thread_); |
764 mutator_thread_->set_zone(zone); | 765 mutator_thread_->set_zone(zone); |
765 } | 766 } |
766 | 767 |
767 bool is_service_isolate() const { return is_service_isolate_; } | 768 bool is_service_isolate() const { return is_service_isolate_; } |
768 | 769 |
769 static void KillAllIsolates(); | 770 static void KillAllIsolates(LibMsgId msg_id); |
770 static void KillIfExists(Isolate* isolate); | 771 static void KillIfExists(Isolate* isolate, LibMsgId msg_id); |
771 | 772 |
772 static void DisableIsolateCreation(); | 773 static void DisableIsolateCreation(); |
773 static void EnableIsolateCreation(); | 774 static void EnableIsolateCreation(); |
774 | 775 |
775 private: | 776 private: |
776 friend class Dart; // Init, InitOnce, Shutdown. | 777 friend class Dart; // Init, InitOnce, Shutdown. |
777 friend class IsolateKillerVisitor; // Kill(). | 778 friend class IsolateKillerVisitor; // Kill(). |
778 | 779 |
779 explicit Isolate(const Dart_IsolateFlags& api_flags); | 780 explicit Isolate(const Dart_IsolateFlags& api_flags); |
780 | 781 |
781 static void InitOnce(); | 782 static void InitOnce(); |
782 static Isolate* Init(const char* name_prefix, | 783 static Isolate* Init(const char* name_prefix, |
783 const Dart_IsolateFlags& api_flags, | 784 const Dart_IsolateFlags& api_flags, |
784 bool is_vm_isolate = false); | 785 bool is_vm_isolate = false); |
785 | 786 |
786 // The isolates_list_monitor_ should be held when calling Kill(). | 787 // The isolates_list_monitor_ should be held when calling Kill(). |
787 void KillLocked(); | 788 void KillLocked(LibMsgId msg_id); |
788 | 789 |
789 void LowLevelShutdown(); | 790 void LowLevelShutdown(); |
790 void Shutdown(); | 791 void Shutdown(); |
791 void ReclaimTimelineBlocks(); | 792 void ReclaimTimelineBlocks(); |
792 | 793 |
793 void BuildName(const char* name_prefix); | 794 void BuildName(const char* name_prefix); |
794 void PrintInvokedFunctions(); | 795 void PrintInvokedFunctions(); |
795 | 796 |
796 void ProfileIdle(); | 797 void ProfileIdle(); |
797 | 798 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 uint8_t* serialized_message_; | 1143 uint8_t* serialized_message_; |
1143 intptr_t serialized_message_len_; | 1144 intptr_t serialized_message_len_; |
1144 Isolate::Flags isolate_flags_; | 1145 Isolate::Flags isolate_flags_; |
1145 bool paused_; | 1146 bool paused_; |
1146 bool errors_are_fatal_; | 1147 bool errors_are_fatal_; |
1147 }; | 1148 }; |
1148 | 1149 |
1149 } // namespace dart | 1150 } // namespace dart |
1150 | 1151 |
1151 #endif // VM_ISOLATE_H_ | 1152 #endif // VM_ISOLATE_H_ |
OLD | NEW |