| 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 #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 Loading... |
| 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 |
| 108 intptr_t ThreadRegistry::CountZoneHandles() const { | 121 intptr_t ThreadRegistry::CountZoneHandles() const { |
| 109 MonitorLocker ml(threads_lock()); | 122 MonitorLocker ml(threads_lock()); |
| 110 intptr_t count = 0; | 123 intptr_t count = 0; |
| 111 Thread* current = active_list_; | 124 Thread* current = active_list_; |
| 112 while (current != NULL) { | 125 while (current != NULL) { |
| 113 count += current->CountZoneHandles(); | 126 count += current->CountZoneHandles(); |
| 114 current = current->next_; | 127 current = current->next_; |
| 115 } | 128 } |
| 116 return count; | 129 return count; |
| 117 } | 130 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 uintptr_t memory_high_watermarks_total = 0; | 201 uintptr_t memory_high_watermarks_total = 0; |
| 189 Thread* current = active_list_; | 202 Thread* current = active_list_; |
| 190 while (current != NULL) { | 203 while (current != NULL) { |
| 191 memory_high_watermarks_total += current->memory_high_watermark(); | 204 memory_high_watermarks_total += current->memory_high_watermark(); |
| 192 current = current->next_; | 205 current = current->next_; |
| 193 } | 206 } |
| 194 return memory_high_watermarks_total; | 207 return memory_high_watermarks_total; |
| 195 } | 208 } |
| 196 | 209 |
| 197 } // namespace dart | 210 } // namespace dart |
| OLD | NEW |