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

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: Merge 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
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 ASSERT(Thread::Current() == mutator_thread_); 747 ASSERT(Thread::Current() == mutator_thread_);
748 return mutator_thread_->zone(); 748 return mutator_thread_->zone();
749 } 749 }
750 void set_current_zone(Zone* zone) { 750 void set_current_zone(Zone* zone) {
751 ASSERT(Thread::Current() == mutator_thread_); 751 ASSERT(Thread::Current() == mutator_thread_);
752 mutator_thread_->set_zone(zone); 752 mutator_thread_->set_zone(zone);
753 } 753 }
754 754
755 bool is_service_isolate() const { return is_service_isolate_; } 755 bool is_service_isolate() const { return is_service_isolate_; }
756 756
757 static void KillAllIsolates();
758 static void KillIfExists(Isolate* isolate);
759
760 static void DisableIsolateCreation();
761 static void EnableIsolateCreation();
762
757 private: 763 private:
758 friend class Dart; // Init, InitOnce, Shutdown. 764 friend class Dart; // Init, InitOnce, Shutdown.
765 friend class IsolateKillerVisitor; // Kill().
759 766
760 explicit Isolate(const Dart_IsolateFlags& api_flags); 767 explicit Isolate(const Dart_IsolateFlags& api_flags);
761 768
762 static void InitOnce(); 769 static void InitOnce();
763 static Isolate* Init(const char* name_prefix, 770 static Isolate* Init(const char* name_prefix,
764 const Dart_IsolateFlags& api_flags, 771 const Dart_IsolateFlags& api_flags,
765 bool is_vm_isolate = false); 772 bool is_vm_isolate = false);
773
774 // The isolates_list_monitor_ should be held when calling Kill().
775 void KillLocked();
776
777 void LowLevelShutdown();
766 void Shutdown(); 778 void Shutdown();
767 // Assumes mutator is the only thread still in the isolate. 779 // Assumes mutator is the only thread still in the isolate.
768 void CloseAllTimelineBlocks(); 780 void CloseAllTimelineBlocks();
769 781
770 void BuildName(const char* name_prefix); 782 void BuildName(const char* name_prefix);
771 void PrintInvokedFunctions(); 783 void PrintInvokedFunctions();
772 784
773 void ProfileIdle(); 785 void ProfileIdle();
774 786
775 // Visit all object pointers. Caller must ensure concurrent sweeper is not 787 // Visit all object pointers. Caller must ensure concurrent sweeper is not
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 static Dart_FileOpenCallback file_open_callback_; 961 static Dart_FileOpenCallback file_open_callback_;
950 static Dart_FileReadCallback file_read_callback_; 962 static Dart_FileReadCallback file_read_callback_;
951 static Dart_FileWriteCallback file_write_callback_; 963 static Dart_FileWriteCallback file_write_callback_;
952 static Dart_FileCloseCallback file_close_callback_; 964 static Dart_FileCloseCallback file_close_callback_;
953 static Dart_EntropySource entropy_source_callback_; 965 static Dart_EntropySource entropy_source_callback_;
954 static Dart_IsolateInterruptCallback vmstats_callback_; 966 static Dart_IsolateInterruptCallback vmstats_callback_;
955 967
956 static void WakePauseEventHandler(Dart_Isolate isolate); 968 static void WakePauseEventHandler(Dart_Isolate isolate);
957 969
958 // Manage list of existing isolates. 970 // Manage list of existing isolates.
959 static void AddIsolateTolist(Isolate* isolate); 971 static bool AddIsolateToList(Isolate* isolate);
960 static void RemoveIsolateFromList(Isolate* isolate); 972 static void RemoveIsolateFromList(Isolate* isolate);
961 973
962 static Monitor* isolates_list_monitor_; // Protects isolates_list_head_ 974 // This monitor protects isolates_list_head_, and creation_enabled_.
975 static Monitor* isolates_list_monitor_;
963 static Isolate* isolates_list_head_; 976 static Isolate* isolates_list_head_;
977 static bool creation_enabled_;
964 978
965 #define REUSABLE_FRIEND_DECLARATION(name) \ 979 #define REUSABLE_FRIEND_DECLARATION(name) \
966 friend class Reusable##name##HandleScope; 980 friend class Reusable##name##HandleScope;
967 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION) 981 REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
968 #undef REUSABLE_FRIEND_DECLARATION 982 #undef REUSABLE_FRIEND_DECLARATION
969 983
970 friend class GCMarker; // VisitObjectPointers 984 friend class GCMarker; // VisitObjectPointers
971 friend class Scavenger; // VisitObjectPointers 985 friend class Scavenger; // VisitObjectPointers
972 friend class ServiceIsolate; 986 friend class ServiceIsolate;
973 friend class Thread; 987 friend class Thread;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 uint8_t* serialized_message_; 1129 uint8_t* serialized_message_;
1116 intptr_t serialized_message_len_; 1130 intptr_t serialized_message_len_;
1117 Isolate::Flags isolate_flags_; 1131 Isolate::Flags isolate_flags_;
1118 bool paused_; 1132 bool paused_;
1119 bool errors_are_fatal_; 1133 bool errors_are_fatal_;
1120 }; 1134 };
1121 1135
1122 } // namespace dart 1136 } // namespace dart
1123 1137
1124 #endif // VM_ISOLATE_H_ 1138 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl_test.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698