| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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_THREAD_REGISTRY_H_ | 5 #ifndef VM_THREAD_REGISTRY_H_ |
| 6 #define VM_THREAD_REGISTRY_H_ | 6 #define VM_THREAD_REGISTRY_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 StackFrame* frame = frames_iterator.NextFrame(); | 135 StackFrame* frame = frames_iterator.NextFrame(); |
| 136 while (frame != NULL) { | 136 while (frame != NULL) { |
| 137 frame->VisitObjectPointers(visitor); | 137 frame->VisitObjectPointers(visitor); |
| 138 frame = frames_iterator.NextFrame(); | 138 frame = frames_iterator.NextFrame(); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 void PruneThread(Thread* thread); | 143 void PruneThread(Thread* thread); |
| 144 | 144 |
| 145 void CloseAllTimelineBlocks(); |
| 146 |
| 145 struct Entry { | 147 struct Entry { |
| 146 // NOTE: |thread| is deleted automatically when the thread exits. | 148 // NOTE: |thread| is deleted automatically when the thread exits. |
| 147 // In other words, it is not safe to dereference |thread| unless you are on | 149 // In other words, it is not safe to dereference |thread| unless you are on |
| 148 // the thread itself. | 150 // the thread itself. |
| 149 Thread* thread; | 151 Thread* thread; |
| 150 bool scheduled; | 152 bool scheduled; |
| 151 Thread::State state; | 153 Thread::State state; |
| 152 }; | 154 }; |
| 153 | 155 |
| 154 class EntryIterator { | 156 class EntryIterator { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 175 // TODO(koda): Add method Monitor::IsOwnedByCurrentThread. | 177 // TODO(koda): Add method Monitor::IsOwnedByCurrentThread. |
| 176 Entry* FindEntry(Thread* thread) { | 178 Entry* FindEntry(Thread* thread) { |
| 177 for (int i = 0; i < entries_.length(); ++i) { | 179 for (int i = 0; i < entries_.length(); ++i) { |
| 178 if (entries_[i].thread == thread) { | 180 if (entries_[i].thread == thread) { |
| 179 return &entries_[i]; | 181 return &entries_[i]; |
| 180 } | 182 } |
| 181 } | 183 } |
| 182 return NULL; | 184 return NULL; |
| 183 } | 185 } |
| 184 | 186 |
| 187 // Close the timeline block cache inside entry. |
| 188 // NOTE: Lock should be taken before this function is called. |
| 189 // NOTE: Recorder lock should be taken before this function is called. |
| 190 void CloseTimelineBlockLocked(Entry* entry); |
| 191 |
| 185 // Note: Lock should be taken before this function is called. | 192 // Note: Lock should be taken before this function is called. |
| 186 void CheckSafepointLocked(); | 193 void CheckSafepointLocked(); |
| 187 | 194 |
| 188 // Returns the number threads that are scheduled on this isolate. | 195 // Returns the number threads that are scheduled on this isolate. |
| 189 // Note: Lock should be taken before this function is called. | 196 // Note: Lock should be taken before this function is called. |
| 190 intptr_t CountScheduledLocked(); | 197 intptr_t CountScheduledLocked(); |
| 191 | 198 |
| 192 Monitor* monitor_; // All access is synchronized through this monitor. | 199 Monitor* monitor_; // All access is synchronized through this monitor. |
| 193 MallocGrowableArray<Entry> entries_; | 200 MallocGrowableArray<Entry> entries_; |
| 194 | 201 |
| 195 // Safepoint rendezvous state. | 202 // Safepoint rendezvous state. |
| 196 bool in_rendezvous_; // A safepoint rendezvous request is in progress. | 203 bool in_rendezvous_; // A safepoint rendezvous request is in progress. |
| 197 intptr_t remaining_; // Number of threads yet to reach their safepoint. | 204 intptr_t remaining_; // Number of threads yet to reach their safepoint. |
| 198 int64_t round_; // Counter, to prevent missing updates to remaining_ | 205 int64_t round_; // Counter, to prevent missing updates to remaining_ |
| 199 // (see comments in CheckSafepointLocked). | 206 // (see comments in CheckSafepointLocked). |
| 200 | 207 |
| 201 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 208 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
| 202 }; | 209 }; |
| 203 | 210 |
| 204 } // namespace dart | 211 } // namespace dart |
| 205 | 212 |
| 206 #endif // VM_THREAD_REGISTRY_H_ | 213 #endif // VM_THREAD_REGISTRY_H_ |
| OLD | NEW |