| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 // to using the mutator thread (which must also be the current thread). | 735 // to using the mutator thread (which must also be the current thread). |
| 736 Zone* current_zone() const { | 736 Zone* current_zone() const { |
| 737 ASSERT(Thread::Current() == mutator_thread_); | 737 ASSERT(Thread::Current() == mutator_thread_); |
| 738 return mutator_thread_->zone(); | 738 return mutator_thread_->zone(); |
| 739 } | 739 } |
| 740 void set_current_zone(Zone* zone) { | 740 void set_current_zone(Zone* zone) { |
| 741 ASSERT(Thread::Current() == mutator_thread_); | 741 ASSERT(Thread::Current() == mutator_thread_); |
| 742 mutator_thread_->set_zone(zone); | 742 mutator_thread_->set_zone(zone); |
| 743 } | 743 } |
| 744 | 744 |
| 745 static void KillIsolate(Isolate* isolate); |
| 746 static void KillAllIsolates(); |
| 747 |
| 748 static void DisableIsolateCreation(); |
| 749 static void EnableIsolateCreation(); |
| 750 |
| 745 private: | 751 private: |
| 746 friend class Dart; // Init, InitOnce, Shutdown. | 752 friend class Dart; // Init, InitOnce, Shutdown. |
| 747 | 753 |
| 748 explicit Isolate(const Dart_IsolateFlags& api_flags); | 754 explicit Isolate(const Dart_IsolateFlags& api_flags); |
| 749 | 755 |
| 750 static void InitOnce(); | 756 static void InitOnce(); |
| 751 static Isolate* Init(const char* name_prefix, | 757 static Isolate* Init(const char* name_prefix, |
| 752 const Dart_IsolateFlags& api_flags, | 758 const Dart_IsolateFlags& api_flags, |
| 753 bool is_vm_isolate = false); | 759 bool is_vm_isolate = false); |
| 760 void LowLevelShutdown(); |
| 754 void Shutdown(); | 761 void Shutdown(); |
| 755 | 762 |
| 756 void BuildName(const char* name_prefix); | 763 void BuildName(const char* name_prefix); |
| 757 void PrintInvokedFunctions(); | 764 void PrintInvokedFunctions(); |
| 758 | 765 |
| 759 void ProfileIdle(); | 766 void ProfileIdle(); |
| 760 | 767 |
| 761 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 768 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
| 762 // running, and the visitor must not allocate. | 769 // running, and the visitor must not allocate. |
| 763 void VisitObjectPointers(ObjectPointerVisitor* visitor, | 770 void VisitObjectPointers(ObjectPointerVisitor* visitor, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 static Dart_FileOpenCallback file_open_callback_; | 917 static Dart_FileOpenCallback file_open_callback_; |
| 911 static Dart_FileReadCallback file_read_callback_; | 918 static Dart_FileReadCallback file_read_callback_; |
| 912 static Dart_FileWriteCallback file_write_callback_; | 919 static Dart_FileWriteCallback file_write_callback_; |
| 913 static Dart_FileCloseCallback file_close_callback_; | 920 static Dart_FileCloseCallback file_close_callback_; |
| 914 static Dart_EntropySource entropy_source_callback_; | 921 static Dart_EntropySource entropy_source_callback_; |
| 915 static Dart_IsolateInterruptCallback vmstats_callback_; | 922 static Dart_IsolateInterruptCallback vmstats_callback_; |
| 916 | 923 |
| 917 static void WakePauseEventHandler(Dart_Isolate isolate); | 924 static void WakePauseEventHandler(Dart_Isolate isolate); |
| 918 | 925 |
| 919 // Manage list of existing isolates. | 926 // Manage list of existing isolates. |
| 920 static void AddIsolateTolist(Isolate* isolate); | 927 static bool AddIsolateToList(Isolate* isolate); |
| 921 static void RemoveIsolateFromList(Isolate* isolate); | 928 static void RemoveIsolateFromList(Isolate* isolate); |
| 922 static void CheckForDuplicateThreadState(InterruptableThreadState* state); | 929 static void CheckForDuplicateThreadState(InterruptableThreadState* state); |
| 923 | 930 |
| 924 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ | 931 // This monitor protects isolates_list_head_, and creation_enabled_. |
| 932 static Monitor* isolates_list_monitor_; |
| 925 static Isolate* isolates_list_head_; | 933 static Isolate* isolates_list_head_; |
| 934 static bool creation_enabled_; |
| 926 | 935 |
| 927 #define REUSABLE_FRIEND_DECLARATION(name) \ | 936 #define REUSABLE_FRIEND_DECLARATION(name) \ |
| 928 friend class Reusable##name##HandleScope; | 937 friend class Reusable##name##HandleScope; |
| 929 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) | 938 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) |
| 930 #undef REUSABLE_FRIEND_DECLARATION | 939 #undef REUSABLE_FRIEND_DECLARATION |
| 931 | 940 |
| 932 friend class GCMarker; // VisitObjectPointers | 941 friend class GCMarker; // VisitObjectPointers |
| 933 friend class Scavenger; // VisitObjectPointers | 942 friend class Scavenger; // VisitObjectPointers |
| 934 friend class ServiceIsolate; | 943 friend class ServiceIsolate; |
| 935 friend class Thread; | 944 friend class Thread; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 uint8_t* serialized_message_; | 1086 uint8_t* serialized_message_; |
| 1078 intptr_t serialized_message_len_; | 1087 intptr_t serialized_message_len_; |
| 1079 Isolate::Flags isolate_flags_; | 1088 Isolate::Flags isolate_flags_; |
| 1080 bool paused_; | 1089 bool paused_; |
| 1081 bool errors_are_fatal_; | 1090 bool errors_are_fatal_; |
| 1082 }; | 1091 }; |
| 1083 | 1092 |
| 1084 } // namespace dart | 1093 } // namespace dart |
| 1085 | 1094 |
| 1086 #endif // VM_ISOLATE_H_ | 1095 #endif // VM_ISOLATE_H_ |
| OLD | NEW |