| 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/service_event.h" | 5 #include "vm/service_event.h" |
| 6 | 6 |
| 7 namespace dart { | 7 namespace dart { |
| 8 | 8 |
| 9 // Translate from the legacy DebugEvent to a ServiceEvent. | 9 // Translate from the legacy DebugEvent to a ServiceEvent. |
| 10 static ServiceEvent::EventType TranslateEventType( | 10 static ServiceEvent::EventType TranslateEventType( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return "Unknown"; | 89 return "Unknown"; |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 void ServiceEvent::PrintJSON(JSONStream* js) const { | 94 void ServiceEvent::PrintJSON(JSONStream* js) const { |
| 95 JSONObject jsobj(js); | 95 JSONObject jsobj(js); |
| 96 jsobj.AddProperty("type", "Event"); | 96 jsobj.AddProperty("type", "Event"); |
| 97 jsobj.AddProperty("kind", EventTypeToCString(type())); | 97 jsobj.AddProperty("kind", EventTypeToCString(type())); |
| 98 jsobj.AddProperty("isolate", isolate()); | 98 jsobj.AddProperty("isolate", isolate()); |
| 99 if (breakpoint() != NULL) { | 99 if (type() == kPauseBreakpoint) { |
| 100 jsobj.AddProperty("breakpoint", breakpoint()); | 100 JSONArray jsarr(&jsobj, "pauseBreakpoints"); |
| 101 // TODO(rmacnak): If we are paused at more than one breakpoint, |
| 102 // provide it here. |
| 103 if (breakpoint() != NULL) { |
| 104 jsarr.AddValue(breakpoint()); |
| 105 } |
| 106 } else { |
| 107 if (breakpoint() != NULL) { |
| 108 jsobj.AddProperty("breakpoint", breakpoint()); |
| 109 } |
| 101 } | 110 } |
| 102 if (top_frame() != NULL) { | 111 if (top_frame() != NULL) { |
| 103 JSONObject jsFrame(&jsobj, "topFrame"); | 112 JSONObject jsFrame(&jsobj, "topFrame"); |
| 104 top_frame()->PrintToJSONObject(&jsFrame); | 113 top_frame()->PrintToJSONObject(&jsFrame); |
| 105 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. | 114 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. |
| 106 jsFrame.AddProperty("index", index); | 115 jsFrame.AddProperty("index", index); |
| 107 } | 116 } |
| 108 if (exception() != NULL) { | 117 if (exception() != NULL) { |
| 109 jsobj.AddProperty("exception", *(exception())); | 118 jsobj.AddProperty("exception", *(exception())); |
| 110 } | 119 } |
| 111 if (inspectee() != NULL) { | 120 if (inspectee() != NULL) { |
| 112 jsobj.AddProperty("inspectee", *(inspectee())); | 121 jsobj.AddProperty("inspectee", *(inspectee())); |
| 113 } | 122 } |
| 114 if (gc_stats() != NULL) { | 123 if (gc_stats() != NULL) { |
| 115 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); | 124 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); |
| 116 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); | 125 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); |
| 117 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); | 126 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); |
| 118 } | 127 } |
| 119 } | 128 } |
| 120 | 129 |
| 121 } // namespace dart | 130 } // namespace dart |
| OLD | NEW |