Index: runtime/vm/thread_registry.cc |
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc |
index c660843c1eac3bd892de539293114b2dae1632c6..5f62350692da94f334c07e9d2bfea0f4d65f51b1 100644 |
--- a/runtime/vm/thread_registry.cc |
+++ b/runtime/vm/thread_registry.cc |
@@ -5,6 +5,7 @@ |
#include "vm/thread_registry.h" |
#include "vm/isolate.h" |
+#include "vm/json_stream.h" |
#include "vm/lockers.h" |
namespace dart { |
@@ -91,6 +92,30 @@ void ThreadRegistry::PrepareForGC() { |
} |
+#ifndef RELEASE |
+void ThreadRegistry::PrintToJSONObjectLocked(JSONObject* obj) { |
+ MonitorLocker ml(threads_lock()); |
+ { |
+ JSONArray active_thread_array(obj, "active_threads"); |
+ PrintToJSONObjectHelper(&active_thread_array, active_list_); |
+ } |
+ { |
+ JSONArray free_thread_array(obj, "free_threads"); |
+ PrintToJSONObjectHelper(&free_thread_array, free_list_); |
+ } |
+} |
+ |
+ |
+void ThreadRegistry::PrintToJSONObjectHelper(JSONArray* arr, Thread* thread) { |
+ while (thread != NULL) { |
+ JSONObject thread_obj(arr); |
+ thread->PrintToJSONObject(&thread_obj); |
+ thread = thread->next_; |
+ } |
+} |
+#endif |
+ |
+ |
void ThreadRegistry::AddToActiveListLocked(Thread* thread) { |
ASSERT(thread != NULL); |
ASSERT(threads_lock()->IsOwnedByCurrentThread()); |