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

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

Issue 1363033003: Make TimelineEventBlocks reclaimable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/thread.cc ('k') | runtime/vm/thread_registry.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) 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
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(); 145 void ReclaimTimelineBlocks();
146 146
147 struct Entry { 147 struct Entry {
148 // NOTE: |thread| is deleted automatically when the thread exits. 148 // NOTE: |thread| is deleted automatically when the thread exits.
149 // 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
150 // the thread itself. 150 // the thread itself.
151 Thread* thread; 151 Thread* thread;
152 bool scheduled; 152 bool scheduled;
153 Thread::State state; 153 Thread::State state;
154 }; 154 };
155 155
(...skipping 21 matching lines...) Expand all
177 // TODO(koda): Add method Monitor::IsOwnedByCurrentThread. 177 // TODO(koda): Add method Monitor::IsOwnedByCurrentThread.
178 Entry* FindEntry(Thread* thread) { 178 Entry* FindEntry(Thread* thread) {
179 for (int i = 0; i < entries_.length(); ++i) { 179 for (int i = 0; i < entries_.length(); ++i) {
180 if (entries_[i].thread == thread) { 180 if (entries_[i].thread == thread) {
181 return &entries_[i]; 181 return &entries_[i];
182 } 182 }
183 } 183 }
184 return NULL; 184 return NULL;
185 } 185 }
186 186
187 // Close the timeline block cache inside entry.
188 // NOTE: Lock should be taken before this function is called. 187 // NOTE: Lock should be taken before this function is called.
189 // NOTE: Recorder lock should be taken before this function is called. 188 void ReclaimTimelineBlockLocked(Entry* entry);
190 void CloseTimelineBlockLocked(Entry* entry);
191 189
192 // Note: Lock should be taken before this function is called. 190 // Note: Lock should be taken before this function is called.
193 void CheckSafepointLocked(); 191 void CheckSafepointLocked();
194 192
195 // Returns the number threads that are scheduled on this isolate. 193 // Returns the number threads that are scheduled on this isolate.
196 // Note: Lock should be taken before this function is called. 194 // Note: Lock should be taken before this function is called.
197 intptr_t CountScheduledLocked(); 195 intptr_t CountScheduledLocked();
198 196
199 Monitor* monitor_; // All access is synchronized through this monitor. 197 Monitor* monitor_; // All access is synchronized through this monitor.
200 MallocGrowableArray<Entry> entries_; 198 MallocGrowableArray<Entry> entries_;
201 199
202 // Safepoint rendezvous state. 200 // Safepoint rendezvous state.
203 bool in_rendezvous_; // A safepoint rendezvous request is in progress. 201 bool in_rendezvous_; // A safepoint rendezvous request is in progress.
204 intptr_t remaining_; // Number of threads yet to reach their safepoint. 202 intptr_t remaining_; // Number of threads yet to reach their safepoint.
205 int64_t round_; // Counter, to prevent missing updates to remaining_ 203 int64_t round_; // Counter, to prevent missing updates to remaining_
206 // (see comments in CheckSafepointLocked). 204 // (see comments in CheckSafepointLocked).
207 205
208 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry); 206 DISALLOW_COPY_AND_ASSIGN(ThreadRegistry);
209 }; 207 };
210 208
211 } // namespace dart 209 } // namespace dart
212 210
213 #endif // VM_THREAD_REGISTRY_H_ 211 #endif // VM_THREAD_REGISTRY_H_
OLDNEW
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/thread_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698