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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 case kBreakpointAdded: | 77 case kBreakpointAdded: |
78 return "BreakpointAdded"; | 78 return "BreakpointAdded"; |
79 case kBreakpointResolved: | 79 case kBreakpointResolved: |
80 return "BreakpointResolved"; | 80 return "BreakpointResolved"; |
81 case kBreakpointRemoved: | 81 case kBreakpointRemoved: |
82 return "BreakpointRemoved"; | 82 return "BreakpointRemoved"; |
83 case kGC: | 83 case kGC: |
84 return "GC"; // TODO(koda): Change to GarbageCollected. | 84 return "GC"; // TODO(koda): Change to GarbageCollected. |
85 case kInspect: | 85 case kInspect: |
86 return "Inspect"; | 86 return "Inspect"; |
| 87 case kIllegal: |
| 88 return "Illegal"; |
87 default: | 89 default: |
88 UNREACHABLE(); | 90 UNREACHABLE(); |
89 return "Unknown"; | 91 return "Unknown"; |
90 } | 92 } |
91 } | 93 } |
92 | 94 |
93 | 95 |
| 96 const char* ServiceEvent::stream_id() const { |
| 97 switch (type()) { |
| 98 case kIsolateStart: |
| 99 case kIsolateExit: |
| 100 case kIsolateUpdate: |
| 101 return "Isolate"; |
| 102 |
| 103 case kPauseStart: |
| 104 case kPauseExit: |
| 105 case kPauseBreakpoint: |
| 106 case kPauseInterrupted: |
| 107 case kPauseException: |
| 108 case kResume: |
| 109 case kBreakpointAdded: |
| 110 case kBreakpointResolved: |
| 111 case kBreakpointRemoved: |
| 112 case kInspect: |
| 113 return "Debug"; |
| 114 |
| 115 case kGC: |
| 116 return "GC"; |
| 117 |
| 118 default: |
| 119 UNREACHABLE(); |
| 120 return NULL; |
| 121 } |
| 122 } |
| 123 |
| 124 |
94 void ServiceEvent::PrintJSON(JSONStream* js) const { | 125 void ServiceEvent::PrintJSON(JSONStream* js) const { |
95 JSONObject jsobj(js); | 126 JSONObject jsobj(js); |
96 jsobj.AddProperty("type", "Event"); | 127 jsobj.AddProperty("type", "Event"); |
97 jsobj.AddProperty("kind", EventTypeToCString(type())); | 128 jsobj.AddProperty("kind", EventTypeToCString(type())); |
98 jsobj.AddProperty("isolate", isolate()); | 129 jsobj.AddProperty("isolate", isolate()); |
99 if (type() == kPauseBreakpoint) { | 130 if (type() == kPauseBreakpoint) { |
100 JSONArray jsarr(&jsobj, "pauseBreakpoints"); | 131 JSONArray jsarr(&jsobj, "pauseBreakpoints"); |
101 // TODO(rmacnak): If we are paused at more than one breakpoint, | 132 // TODO(rmacnak): If we are paused at more than one breakpoint, |
102 // provide it here. | 133 // provide it here. |
103 if (breakpoint() != NULL) { | 134 if (breakpoint() != NULL) { |
(...skipping 17 matching lines...) Expand all Loading... |
121 jsobj.AddProperty("inspectee", *(inspectee())); | 152 jsobj.AddProperty("inspectee", *(inspectee())); |
122 } | 153 } |
123 if (gc_stats() != NULL) { | 154 if (gc_stats() != NULL) { |
124 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); | 155 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); |
125 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); | 156 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); |
126 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); | 157 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); |
127 } | 158 } |
128 } | 159 } |
129 | 160 |
130 } // namespace dart | 161 } // namespace dart |
OLD | NEW |