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 #include "vm/message_handler.h" | 7 #include "vm/message_handler.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) | 38 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) |
39 : isolate_(isolate), | 39 : isolate_(isolate), |
40 kind_(event_kind), | 40 kind_(event_kind), |
41 embedder_kind_(NULL), | 41 embedder_kind_(NULL), |
42 embedder_stream_id_(NULL), | 42 embedder_stream_id_(NULL), |
43 breakpoint_(NULL), | 43 breakpoint_(NULL), |
44 top_frame_(NULL), | 44 top_frame_(NULL), |
45 extension_rpc_(NULL), | 45 extension_rpc_(NULL), |
46 exception_(NULL), | 46 exception_(NULL), |
47 async_continuation_(NULL), | |
48 at_async_jump_(false), | 47 at_async_jump_(false), |
49 inspectee_(NULL), | 48 inspectee_(NULL), |
50 gc_stats_(NULL), | 49 gc_stats_(NULL), |
51 bytes_(NULL), | 50 bytes_(NULL), |
52 bytes_length_(0), | 51 bytes_length_(0), |
53 timestamp_(OS::GetCurrentTimeMillis()) { | 52 timestamp_(OS::GetCurrentTimeMillis()) { |
54 if ((event_kind == ServiceEvent::kPauseStart) || | 53 if ((event_kind == ServiceEvent::kPauseStart) || |
55 (event_kind == ServiceEvent::kPauseExit)) { | 54 (event_kind == ServiceEvent::kPauseExit)) { |
56 timestamp_ = isolate->message_handler()->paused_timestamp(); | 55 timestamp_ = isolate->message_handler()->paused_timestamp(); |
57 } else if (event_kind == ServiceEvent::kResume) { | 56 } else if (event_kind == ServiceEvent::kResume) { |
58 timestamp_ = isolate->last_resume_timestamp(); | 57 timestamp_ = isolate->last_resume_timestamp(); |
59 } | 58 } |
60 } | 59 } |
61 | 60 |
62 | 61 |
63 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) | 62 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) |
64 : isolate_(debugger_event->isolate()), | 63 : isolate_(debugger_event->isolate()), |
65 kind_(TranslateEventKind(debugger_event->type())), | 64 kind_(TranslateEventKind(debugger_event->type())), |
66 breakpoint_(NULL), | 65 breakpoint_(NULL), |
67 top_frame_(NULL), | 66 top_frame_(NULL), |
68 extension_rpc_(NULL), | 67 extension_rpc_(NULL), |
69 exception_(NULL), | 68 exception_(NULL), |
70 async_continuation_(NULL), | 69 at_async_jump_(false), |
71 inspectee_(NULL), | 70 inspectee_(NULL), |
72 gc_stats_(NULL), | 71 gc_stats_(NULL), |
73 bytes_(NULL), | 72 bytes_(NULL), |
74 bytes_length_(0), | 73 bytes_length_(0), |
75 timestamp_(OS::GetCurrentTimeMillis()) { | 74 timestamp_(OS::GetCurrentTimeMillis()) { |
76 DebuggerEvent::EventType type = debugger_event->type(); | 75 DebuggerEvent::EventType type = debugger_event->type(); |
77 if (type == DebuggerEvent::kBreakpointReached) { | 76 if (type == DebuggerEvent::kBreakpointReached) { |
78 set_breakpoint(debugger_event->breakpoint()); | 77 set_breakpoint(debugger_event->breakpoint()); |
79 set_async_continuation(debugger_event->async_continuation()); | |
80 set_at_async_jump(debugger_event->at_async_jump()); | 78 set_at_async_jump(debugger_event->at_async_jump()); |
81 } | 79 } |
82 if (type == DebuggerEvent::kExceptionThrown) { | 80 if (type == DebuggerEvent::kExceptionThrown) { |
83 set_exception(debugger_event->exception()); | 81 set_exception(debugger_event->exception()); |
84 } | 82 } |
85 if (type == DebuggerEvent::kBreakpointReached || | 83 if (type == DebuggerEvent::kBreakpointReached || |
86 type == DebuggerEvent::kIsolateInterrupted || | 84 type == DebuggerEvent::kIsolateInterrupted || |
87 type == DebuggerEvent::kExceptionThrown) { | 85 type == DebuggerEvent::kExceptionThrown) { |
88 set_top_frame(debugger_event->top_frame()); | 86 set_top_frame(debugger_event->top_frame()); |
89 } | 87 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 213 } |
216 if ((top_frame() != NULL) && Isolate::Current()->compilation_allowed()) { | 214 if ((top_frame() != NULL) && Isolate::Current()->compilation_allowed()) { |
217 JSONObject jsFrame(&jsobj, "topFrame"); | 215 JSONObject jsFrame(&jsobj, "topFrame"); |
218 top_frame()->PrintToJSONObject(&jsFrame); | 216 top_frame()->PrintToJSONObject(&jsFrame); |
219 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. | 217 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. |
220 jsFrame.AddProperty("index", index); | 218 jsFrame.AddProperty("index", index); |
221 } | 219 } |
222 if (exception() != NULL) { | 220 if (exception() != NULL) { |
223 jsobj.AddProperty("exception", *(exception())); | 221 jsobj.AddProperty("exception", *(exception())); |
224 } | 222 } |
225 if (async_continuation() != NULL && !async_continuation()->IsNull()) { | 223 if (at_async_jump()) { |
226 jsobj.AddProperty("_asyncContinuation", *(async_continuation())); | 224 jsobj.AddProperty("atAsyncSuspension", true); |
227 jsobj.AddProperty("_atAsyncJump", at_async_jump()); | |
228 } | 225 } |
229 if (inspectee() != NULL) { | 226 if (inspectee() != NULL) { |
230 jsobj.AddProperty("inspectee", *(inspectee())); | 227 jsobj.AddProperty("inspectee", *(inspectee())); |
231 } | 228 } |
232 if (gc_stats() != NULL) { | 229 if (gc_stats() != NULL) { |
233 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); | 230 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); |
234 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); | 231 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); |
235 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); | 232 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); |
236 } | 233 } |
237 if (bytes() != NULL) { | 234 if (bytes() != NULL) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } else { | 266 } else { |
270 jsobj->AddProperty("isolate", isolate()); | 267 jsobj->AddProperty("isolate", isolate()); |
271 } | 268 } |
272 ASSERT(timestamp_ != -1); | 269 ASSERT(timestamp_ != -1); |
273 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); | 270 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
274 } | 271 } |
275 | 272 |
276 #endif // !PRODUCT | 273 #endif // !PRODUCT |
277 | 274 |
278 } // namespace dart | 275 } // namespace dart |
OLD | NEW |