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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ASSERT(entry->scheduled); | 56 ASSERT(entry->scheduled); |
57 entry->scheduled = false; | 57 entry->scheduled = false; |
58 entry->state = state; | 58 entry->state = state; |
59 } | 59 } |
60 | 60 |
61 bool Contains(Thread* thread) { | 61 bool Contains(Thread* thread) { |
62 MutexLocker ml(mutex_); | 62 MutexLocker ml(mutex_); |
63 return (FindEntry(thread) != NULL); | 63 return (FindEntry(thread) != NULL); |
64 } | 64 } |
65 | 65 |
| 66 void CheckNotScheduled(Isolate* isolate) { |
| 67 MutexLocker ml(mutex_); |
| 68 for (int i = 0; i < entries_.length(); ++i) { |
| 69 const Entry& entry = entries_[i]; |
| 70 if (entry.scheduled) { |
| 71 FATAL3("Isolate %p still scheduled on %p (whose isolate_ is %p)\n", |
| 72 isolate, |
| 73 entry.thread, |
| 74 entry.thread->isolate()); |
| 75 } |
| 76 } |
| 77 } |
| 78 |
66 void VisitObjectPointers(ObjectPointerVisitor* visitor) { | 79 void VisitObjectPointers(ObjectPointerVisitor* visitor) { |
67 MutexLocker ml(mutex_); | 80 MutexLocker ml(mutex_); |
68 for (int i = 0; i < entries_.length(); ++i) { | 81 for (int i = 0; i < entries_.length(); ++i) { |
69 const Entry& entry = entries_[i]; | 82 const Entry& entry = entries_[i]; |
70 Zone* zone = entry.scheduled ? entry.thread->zone() : entry.state.zone; | 83 Zone* zone = entry.scheduled ? entry.thread->zone() : entry.state.zone; |
71 if (zone != NULL) { | 84 if (zone != NULL) { |
72 zone->VisitObjectPointers(visitor); | 85 zone->VisitObjectPointers(visitor); |
73 } | 86 } |
74 } | 87 } |
75 } | 88 } |
(...skipping 20 matching lines...) Expand all Loading... |
96 Mutex* mutex_; | 109 Mutex* mutex_; |
97 MallocGrowableArray<Entry> entries_; | 110 MallocGrowableArray<Entry> entries_; |
98 | 111 |
99 | 112 |
100 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); | 113 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); |
101 }; | 114 }; |
102 | 115 |
103 } // namespace dart | 116 } // namespace dart |
104 | 117 |
105 #endif // VM_THREAD_REGISTRY_H_ | 118 #endif // VM_THREAD_REGISTRY_H_ |
OLD | NEW |