| 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::EventKind TranslateEventKind( | 10 static ServiceEvent::EventKind TranslateEventKind( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return ServiceEvent::kIllegal; | 29 return ServiceEvent::kIllegal; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) | 33 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) |
| 34 : isolate_(debugger_event->isolate()), | 34 : isolate_(debugger_event->isolate()), |
| 35 kind_(TranslateEventKind(debugger_event->type())), | 35 kind_(TranslateEventKind(debugger_event->type())), |
| 36 breakpoint_(NULL), | 36 breakpoint_(NULL), |
| 37 top_frame_(NULL), | 37 top_frame_(NULL), |
| 38 exception_(NULL), | 38 exception_(NULL), |
| 39 async_continuation_(NULL), |
| 39 inspectee_(NULL), | 40 inspectee_(NULL), |
| 40 gc_stats_(NULL), | 41 gc_stats_(NULL), |
| 41 bytes_(NULL), | 42 bytes_(NULL), |
| 42 bytes_length_(0) { | 43 bytes_length_(0) { |
| 43 DebuggerEvent::EventType type = debugger_event->type(); | 44 DebuggerEvent::EventType type = debugger_event->type(); |
| 44 if (type == DebuggerEvent::kBreakpointReached) { | 45 if (type == DebuggerEvent::kBreakpointReached) { |
| 45 set_breakpoint(debugger_event->breakpoint()); | 46 set_breakpoint(debugger_event->breakpoint()); |
| 47 set_async_continuation(debugger_event->async_continuation()); |
| 46 } | 48 } |
| 47 if (type == DebuggerEvent::kExceptionThrown) { | 49 if (type == DebuggerEvent::kExceptionThrown) { |
| 48 set_exception(debugger_event->exception()); | 50 set_exception(debugger_event->exception()); |
| 49 } | 51 } |
| 50 if (type == DebuggerEvent::kBreakpointReached || | 52 if (type == DebuggerEvent::kBreakpointReached || |
| 51 type == DebuggerEvent::kIsolateInterrupted || | 53 type == DebuggerEvent::kIsolateInterrupted || |
| 52 type == DebuggerEvent::kExceptionThrown) { | 54 type == DebuggerEvent::kExceptionThrown) { |
| 53 set_top_frame(debugger_event->top_frame()); | 55 set_top_frame(debugger_event->top_frame()); |
| 54 } | 56 } |
| 55 } | 57 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 156 } |
| 155 if (top_frame() != NULL) { | 157 if (top_frame() != NULL) { |
| 156 JSONObject jsFrame(&jsobj, "topFrame"); | 158 JSONObject jsFrame(&jsobj, "topFrame"); |
| 157 top_frame()->PrintToJSONObject(&jsFrame); | 159 top_frame()->PrintToJSONObject(&jsFrame); |
| 158 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. | 160 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. |
| 159 jsFrame.AddProperty("index", index); | 161 jsFrame.AddProperty("index", index); |
| 160 } | 162 } |
| 161 if (exception() != NULL) { | 163 if (exception() != NULL) { |
| 162 jsobj.AddProperty("exception", *(exception())); | 164 jsobj.AddProperty("exception", *(exception())); |
| 163 } | 165 } |
| 166 if (async_continuation() != NULL) { |
| 167 jsobj.AddProperty("_asyncContinuation", *(async_continuation())); |
| 168 } |
| 164 if (inspectee() != NULL) { | 169 if (inspectee() != NULL) { |
| 165 jsobj.AddProperty("inspectee", *(inspectee())); | 170 jsobj.AddProperty("inspectee", *(inspectee())); |
| 166 } | 171 } |
| 167 if (gc_stats() != NULL) { | 172 if (gc_stats() != NULL) { |
| 168 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); | 173 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); |
| 169 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); | 174 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); |
| 170 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); | 175 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); |
| 171 } | 176 } |
| 172 if (bytes() != NULL) { | 177 if (bytes() != NULL) { |
| 173 jsobj.AddPropertyBase64("bytes", bytes(), bytes_length()); | 178 jsobj.AddPropertyBase64("bytes", bytes(), bytes_length()); |
| 174 } | 179 } |
| 175 } | 180 } |
| 176 | 181 |
| 177 } // namespace dart | 182 } // namespace dart |
| OLD | NEW |