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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return "Inspect"; | 86 return "Inspect"; |
87 default: | 87 default: |
88 UNREACHABLE(); | 88 UNREACHABLE(); |
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", "ServiceEvent"); | 96 jsobj.AddProperty("type", "Event"); |
97 jsobj.AddProperty("eventType", EventTypeToCString(type())); | 97 jsobj.AddProperty("eventType", EventTypeToCString(type())); |
98 jsobj.AddProperty("isolate", isolate()); | 98 jsobj.AddProperty("isolate", isolate()); |
99 if (breakpoint() != NULL) { | 99 if (breakpoint() != NULL) { |
100 jsobj.AddProperty("breakpoint", breakpoint()); | 100 jsobj.AddProperty("breakpoint", breakpoint()); |
101 } | 101 } |
102 if (top_frame() != NULL) { | 102 if (top_frame() != NULL) { |
103 JSONObject jsFrame(&jsobj, "topFrame"); | 103 JSONObject jsFrame(&jsobj, "topFrame"); |
104 top_frame()->PrintToJSONObject(&jsFrame); | 104 top_frame()->PrintToJSONObject(&jsFrame); |
105 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. | 105 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. |
106 jsFrame.AddProperty("index", index); | 106 jsFrame.AddProperty("index", index); |
107 } | 107 } |
108 if (exception() != NULL) { | 108 if (exception() != NULL) { |
109 jsobj.AddProperty("exception", *(exception())); | 109 jsobj.AddProperty("exception", *(exception())); |
110 } | 110 } |
111 if (inspectee() != NULL) { | 111 if (inspectee() != NULL) { |
112 jsobj.AddProperty("inspectee", *(inspectee())); | 112 jsobj.AddProperty("inspectee", *(inspectee())); |
113 } | 113 } |
114 if (gc_stats() != NULL) { | 114 if (gc_stats() != NULL) { |
115 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); | 115 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); |
116 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); | 116 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); |
117 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); | 117 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 } // namespace dart | 121 } // namespace dart |
OLD | NEW |