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

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

Issue 2672833003: Fix for issue #28606. Removed loop which iterated over all threads in the thread registry to check … (Closed)
Patch Set: Fix for issue #28606. Removed loop which iterated over all threads in the thread registry to check … Created 3 years, 10 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_registry.h ('k') | no next file » | 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 #include "vm/thread_registry.h" 5 #include "vm/thread_registry.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/json_stream.h" 8 #include "vm/json_stream.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 JSONArray threads(stream); 98 JSONArray threads(stream);
99 Thread* current = active_list_; 99 Thread* current = active_list_;
100 while (current != NULL) { 100 while (current != NULL) {
101 threads.AddValue(current); 101 threads.AddValue(current);
102 current = current->next_; 102 current = current->next_;
103 } 103 }
104 } 104 }
105 #endif 105 #endif
106 106
107 107
108 bool ThreadRegistry::IsValidHandle(Dart_Handle handle) const {
109 MonitorLocker ml(threads_lock());
110 Thread* current = active_list_;
111 while (current != NULL) {
112 if (current->IsValidHandle(handle)) {
113 return true;
114 }
115 current = current->next_;
116 }
117 return false;
118 }
119
120
121 intptr_t ThreadRegistry::CountZoneHandles() const { 108 intptr_t ThreadRegistry::CountZoneHandles() const {
122 MonitorLocker ml(threads_lock()); 109 MonitorLocker ml(threads_lock());
123 intptr_t count = 0; 110 intptr_t count = 0;
124 Thread* current = active_list_; 111 Thread* current = active_list_;
125 while (current != NULL) { 112 while (current != NULL) {
126 count += current->CountZoneHandles(); 113 count += current->CountZoneHandles();
127 current = current->next_; 114 current = current->next_;
128 } 115 }
129 return count; 116 return count;
130 } 117 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT(thread->os_thread_ == NULL); 176 ASSERT(thread->os_thread_ == NULL);
190 ASSERT(thread->isolate_ == NULL); 177 ASSERT(thread->isolate_ == NULL);
191 ASSERT(thread->heap_ == NULL); 178 ASSERT(thread->heap_ == NULL);
192 ASSERT(threads_lock()->IsOwnedByCurrentThread()); 179 ASSERT(threads_lock()->IsOwnedByCurrentThread());
193 // Add thread to the free list. 180 // Add thread to the free list.
194 thread->next_ = free_list_; 181 thread->next_ = free_list_;
195 free_list_ = thread; 182 free_list_ = thread;
196 } 183 }
197 184
198 } // namespace dart 185 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698