Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: runtime/vm/isolate.h

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 ASSERT(Thread::Current() == mutator_thread_); 751 ASSERT(Thread::Current() == mutator_thread_);
752 return mutator_thread_->zone(); 752 return mutator_thread_->zone();
753 } 753 }
754 void set_current_zone(Zone* zone) { 754 void set_current_zone(Zone* zone) {
755 ASSERT(Thread::Current() == mutator_thread_); 755 ASSERT(Thread::Current() == mutator_thread_);
756 mutator_thread_->set_zone(zone); 756 mutator_thread_->set_zone(zone);
757 } 757 }
758 758
759 bool is_service_isolate() const { return is_service_isolate_; } 759 bool is_service_isolate() const { return is_service_isolate_; }
760 760
761 static void KillAllIsolates();
762 static void KillIfExists(Isolate* isolate);
763
764 static void DisableIsolateCreation();
765 static void EnableIsolateCreation();
766
761 private: 767 private:
762 friend class Dart; // Init, InitOnce, Shutdown. 768 friend class Dart; // Init, InitOnce, Shutdown.
769 friend class IsolateKillerVisitor; // Kill().
763 770
764 explicit Isolate(const Dart_IsolateFlags& api_flags); 771 explicit Isolate(const Dart_IsolateFlags& api_flags);
765 772
766 static void InitOnce(); 773 static void InitOnce();
767 static Isolate* Init(const char* name_prefix, 774 static Isolate* Init(const char* name_prefix,
768 const Dart_IsolateFlags& api_flags, 775 const Dart_IsolateFlags& api_flags,
769 bool is_vm_isolate = false); 776 bool is_vm_isolate = false);
777
778 // The isolates_list_monitor_ should be held when calling Kill().
779 void Kill();
Ivan Posva 2015/09/15 16:18:42 KillLocked to indicate that the lock should be hel
780
781 void LowLevelShutdown();
770 void Shutdown(); 782 void Shutdown();
771 // Assumes mutator is the only thread still in the isolate. 783 // Assumes mutator is the only thread still in the isolate.
772 void CloseAllTimelineBlocks(); 784 void CloseAllTimelineBlocks();
773 785
774 void BuildName(const char* name_prefix); 786 void BuildName(const char* name_prefix);
775 void PrintInvokedFunctions(); 787 void PrintInvokedFunctions();
776 788
777 void ProfileIdle(); 789 void ProfileIdle();
778 790
779 // Visit all object pointers. Caller must ensure concurrent sweeper is not 791 // Visit all object pointers. Caller must ensure concurrent sweeper is not
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 static Dart_FileOpenCallback file_open_callback_; 966 static Dart_FileOpenCallback file_open_callback_;
955 static Dart_FileReadCallback file_read_callback_; 967 static Dart_FileReadCallback file_read_callback_;
956 static Dart_FileWriteCallback file_write_callback_; 968 static Dart_FileWriteCallback file_write_callback_;
957 static Dart_FileCloseCallback file_close_callback_; 969 static Dart_FileCloseCallback file_close_callback_;
958 static Dart_EntropySource entropy_source_callback_; 970 static Dart_EntropySource entropy_source_callback_;
959 static Dart_IsolateInterruptCallback vmstats_callback_; 971 static Dart_IsolateInterruptCallback vmstats_callback_;
960 972
961 static void WakePauseEventHandler(Dart_Isolate isolate); 973 static void WakePauseEventHandler(Dart_Isolate isolate);
962 974
963 // Manage list of existing isolates. 975 // Manage list of existing isolates.
964 static void AddIsolateTolist(Isolate* isolate); 976 static bool AddIsolateToList(Isolate* isolate);
965 static void RemoveIsolateFromList(Isolate* isolate); 977 static void RemoveIsolateFromList(Isolate* isolate);
966 978
967 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ 979 // This monitor protects isolates_list_head_, and creation_enabled_.
980 static Monitor* isolates_list_monitor_;
968 static Isolate* isolates_list_head_; 981 static Isolate* isolates_list_head_;
982 static bool creation_enabled_;
969 983
970 #define REUSABLE_FRIEND_DECLARATION(name) \ 984 #define REUSABLE_FRIEND_DECLARATION(name) \
971 friend class Reusable##name##HandleScope; 985 friend class Reusable##name##HandleScope;
972 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) 986 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
973 #undef REUSABLE_FRIEND_DECLARATION 987 #undef REUSABLE_FRIEND_DECLARATION
974 988
975 friend class GCMarker; // VisitObjectPointers 989 friend class GCMarker; // VisitObjectPointers
976 friend class Scavenger; // VisitObjectPointers 990 friend class Scavenger; // VisitObjectPointers
977 friend class ServiceIsolate; 991 friend class ServiceIsolate;
978 friend class Thread; 992 friend class Thread;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 uint8_t* serialized_message_; 1134 uint8_t* serialized_message_;
1121 intptr_t serialized_message_len_; 1135 intptr_t serialized_message_len_;
1122 Isolate::Flags isolate_flags_; 1136 Isolate::Flags isolate_flags_;
1123 bool paused_; 1137 bool paused_;
1124 bool errors_are_fatal_; 1138 bool errors_are_fatal_;
1125 }; 1139 };
1126 1140
1127 } // namespace dart 1141 } // namespace dart
1128 1142
1129 #endif // VM_ISOLATE_H_ 1143 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698