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/base_isolate.h" | 10 #include "vm/base_isolate.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // to using the mutator thread (which must also be the current thread). | 740 // to using the mutator thread (which must also be the current thread). |
741 Zone* current_zone() const { | 741 Zone* current_zone() const { |
742 ASSERT(Thread::Current() == mutator_thread_); | 742 ASSERT(Thread::Current() == mutator_thread_); |
743 return mutator_thread_->zone(); | 743 return mutator_thread_->zone(); |
744 } | 744 } |
745 void set_current_zone(Zone* zone) { | 745 void set_current_zone(Zone* zone) { |
746 ASSERT(Thread::Current() == mutator_thread_); | 746 ASSERT(Thread::Current() == mutator_thread_); |
747 mutator_thread_->set_zone(zone); | 747 mutator_thread_->set_zone(zone); |
748 } | 748 } |
749 | 749 |
750 static void KillIsolate(Isolate* isolate); | |
751 static void KillAllIsolates(); | |
752 | |
753 static void DisableIsolateCreation(); | |
754 static void EnableIsolateCreation(); | |
755 | |
756 static int IsolateCount(); | |
757 | |
758 private: | 750 private: |
759 friend class Dart; // Init, InitOnce, Shutdown. | 751 friend class Dart; // Init, InitOnce, Shutdown. |
760 | 752 |
761 explicit Isolate(const Dart_IsolateFlags& api_flags); | 753 explicit Isolate(const Dart_IsolateFlags& api_flags); |
762 | 754 |
763 static void InitOnce(); | 755 static void InitOnce(); |
764 static Isolate* Init(const char* name_prefix, | 756 static Isolate* Init(const char* name_prefix, |
765 const Dart_IsolateFlags& api_flags, | 757 const Dart_IsolateFlags& api_flags, |
766 bool is_vm_isolate = false); | 758 bool is_vm_isolate = false); |
767 void Shutdown(); | 759 void Shutdown(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 static Dart_FileOpenCallback file_open_callback_; | 916 static Dart_FileOpenCallback file_open_callback_; |
925 static Dart_FileReadCallback file_read_callback_; | 917 static Dart_FileReadCallback file_read_callback_; |
926 static Dart_FileWriteCallback file_write_callback_; | 918 static Dart_FileWriteCallback file_write_callback_; |
927 static Dart_FileCloseCallback file_close_callback_; | 919 static Dart_FileCloseCallback file_close_callback_; |
928 static Dart_EntropySource entropy_source_callback_; | 920 static Dart_EntropySource entropy_source_callback_; |
929 static Dart_IsolateInterruptCallback vmstats_callback_; | 921 static Dart_IsolateInterruptCallback vmstats_callback_; |
930 | 922 |
931 static void WakePauseEventHandler(Dart_Isolate isolate); | 923 static void WakePauseEventHandler(Dart_Isolate isolate); |
932 | 924 |
933 // Manage list of existing isolates. | 925 // Manage list of existing isolates. |
934 static bool AddIsolateToList(Isolate* isolate); | 926 static void AddIsolateTolist(Isolate* isolate); |
935 static void RemoveIsolateFromList(Isolate* isolate); | 927 static void RemoveIsolateFromList(Isolate* isolate); |
936 static void CheckForDuplicateThreadState(InterruptableThreadState* state); | 928 static void CheckForDuplicateThreadState(InterruptableThreadState* state); |
937 | 929 |
938 // This monitor protects isolates_list_head_, and creation_enabled_. | 930 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ |
939 static Monitor* isolates_list_monitor_; | |
940 static Isolate* isolates_list_head_; | 931 static Isolate* isolates_list_head_; |
941 static bool creation_enabled_; | |
942 | 932 |
943 #define REUSABLE_FRIEND_DECLARATION(name) \ | 933 #define REUSABLE_FRIEND_DECLARATION(name) \ |
944 friend class Reusable##name##HandleScope; | 934 friend class Reusable##name##HandleScope; |
945 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 935 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
946 #undef REUSABLE_FRIEND_DECLARATION | 936 #undef REUSABLE_FRIEND_DECLARATION |
947 | 937 |
948 friend class GCMarker; // VisitObjectPointers | 938 friend class GCMarker; // VisitObjectPointers |
949 friend class Scavenger; // VisitObjectPointers | 939 friend class Scavenger; // VisitObjectPointers |
950 friend class ServiceIsolate; | 940 friend class ServiceIsolate; |
951 friend class Thread; | 941 friend class Thread; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 uint8_t* serialized_message_; | 1083 uint8_t* serialized_message_; |
1094 intptr_t serialized_message_len_; | 1084 intptr_t serialized_message_len_; |
1095 Isolate::Flags isolate_flags_; | 1085 Isolate::Flags isolate_flags_; |
1096 bool paused_; | 1086 bool paused_; |
1097 bool errors_are_fatal_; | 1087 bool errors_are_fatal_; |
1098 }; | 1088 }; |
1099 | 1089 |
1100 } // namespace dart | 1090 } // namespace dart |
1101 | 1091 |
1102 #endif // VM_ISOLATE_H_ | 1092 #endif // VM_ISOLATE_H_ |
OLD | NEW |