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/debugger.h" | 7 #include "vm/debugger.h" |
8 #include "vm/message_handler.h" | 8 #include "vm/message_handler.h" |
9 #include "vm/service_isolate.h" | 9 #include "vm/service_isolate.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 #ifndef PRODUCT | 13 #ifndef PRODUCT |
14 | 14 |
15 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) | 15 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) |
16 : isolate_(isolate), | 16 : isolate_(isolate), |
17 kind_(event_kind), | 17 kind_(event_kind), |
18 embedder_kind_(NULL), | 18 embedder_kind_(NULL), |
19 embedder_stream_id_(NULL), | 19 embedder_stream_id_(NULL), |
20 breakpoint_(NULL), | 20 breakpoint_(NULL), |
21 top_frame_(NULL), | 21 top_frame_(NULL), |
22 timeline_event_block_(NULL), | 22 timeline_event_block_(NULL), |
23 extension_rpc_(NULL), | 23 extension_rpc_(NULL), |
24 exception_(NULL), | 24 exception_(NULL), |
| 25 reload_error_(NULL), |
25 at_async_jump_(false), | 26 at_async_jump_(false), |
26 inspectee_(NULL), | 27 inspectee_(NULL), |
27 gc_stats_(NULL), | 28 gc_stats_(NULL), |
28 bytes_(NULL), | 29 bytes_(NULL), |
29 bytes_length_(0), | 30 bytes_length_(0), |
30 timestamp_(OS::GetCurrentTimeMillis()) { | 31 timestamp_(OS::GetCurrentTimeMillis()) { |
31 // We should never generate events for the vm or service isolates. | 32 // We should never generate events for the vm or service isolates. |
32 ASSERT(isolate_ != Dart::vm_isolate()); | 33 ASSERT(isolate_ != Dart::vm_isolate()); |
33 ASSERT(isolate == NULL || | 34 ASSERT(isolate == NULL || |
34 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); | 35 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); |
(...skipping 24 matching lines...) Expand all Loading... |
59 case kIsolateStart: | 60 case kIsolateStart: |
60 return "IsolateStart"; | 61 return "IsolateStart"; |
61 case kIsolateRunnable: | 62 case kIsolateRunnable: |
62 return "IsolateRunnable"; | 63 return "IsolateRunnable"; |
63 case kIsolateExit: | 64 case kIsolateExit: |
64 return "IsolateExit"; | 65 return "IsolateExit"; |
65 case kIsolateUpdate: | 66 case kIsolateUpdate: |
66 return "IsolateUpdate"; | 67 return "IsolateUpdate"; |
67 case kServiceExtensionAdded: | 68 case kServiceExtensionAdded: |
68 return "ServiceExtensionAdded"; | 69 return "ServiceExtensionAdded"; |
| 70 case kIsolateReload: |
| 71 return "IsolateReload"; |
69 case kPauseStart: | 72 case kPauseStart: |
70 return "PauseStart"; | 73 return "PauseStart"; |
71 case kPauseExit: | 74 case kPauseExit: |
72 return "PauseExit"; | 75 return "PauseExit"; |
73 case kPauseBreakpoint: | 76 case kPauseBreakpoint: |
74 return "PauseBreakpoint"; | 77 return "PauseBreakpoint"; |
75 case kPauseInterrupted: | 78 case kPauseInterrupted: |
76 return "PauseInterrupted"; | 79 return "PauseInterrupted"; |
77 case kPauseException: | 80 case kPauseException: |
78 return "PauseException"; | 81 return "PauseException"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 114 |
112 const StreamInfo* ServiceEvent::stream_info() const { | 115 const StreamInfo* ServiceEvent::stream_info() const { |
113 switch (kind()) { | 116 switch (kind()) { |
114 case kVMUpdate: | 117 case kVMUpdate: |
115 return &Service::vm_stream; | 118 return &Service::vm_stream; |
116 | 119 |
117 case kIsolateStart: | 120 case kIsolateStart: |
118 case kIsolateRunnable: | 121 case kIsolateRunnable: |
119 case kIsolateExit: | 122 case kIsolateExit: |
120 case kIsolateUpdate: | 123 case kIsolateUpdate: |
| 124 case kIsolateReload: |
121 case kServiceExtensionAdded: | 125 case kServiceExtensionAdded: |
122 return &Service::isolate_stream; | 126 return &Service::isolate_stream; |
123 | 127 |
124 case kPauseStart: | 128 case kPauseStart: |
125 case kPauseExit: | 129 case kPauseExit: |
126 case kPauseBreakpoint: | 130 case kPauseBreakpoint: |
127 case kPauseInterrupted: | 131 case kPauseInterrupted: |
128 case kPauseException: | 132 case kPauseException: |
129 case kNone: | 133 case kNone: |
130 case kResume: | 134 case kResume: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return embedder_stream_id_; | 168 return embedder_stream_id_; |
165 } else { | 169 } else { |
166 return stream->id(); | 170 return stream->id(); |
167 } | 171 } |
168 } | 172 } |
169 | 173 |
170 | 174 |
171 void ServiceEvent::PrintJSON(JSONStream* js) const { | 175 void ServiceEvent::PrintJSON(JSONStream* js) const { |
172 JSONObject jsobj(js); | 176 JSONObject jsobj(js); |
173 PrintJSONHeader(&jsobj); | 177 PrintJSONHeader(&jsobj); |
| 178 if (kind() == kIsolateReload) { |
| 179 if (reload_error_ == NULL) { |
| 180 jsobj.AddProperty("status", "success"); |
| 181 } else { |
| 182 jsobj.AddProperty("status", "failure"); |
| 183 jsobj.AddProperty("reloadError", *(reload_error())); |
| 184 } |
| 185 } |
174 if (kind() == kServiceExtensionAdded) { | 186 if (kind() == kServiceExtensionAdded) { |
175 ASSERT(extension_rpc_ != NULL); | 187 ASSERT(extension_rpc_ != NULL); |
176 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString()); | 188 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString()); |
177 } | 189 } |
178 if (kind() == kPauseBreakpoint) { | 190 if (kind() == kPauseBreakpoint) { |
179 JSONArray jsarr(&jsobj, "pauseBreakpoints"); | 191 JSONArray jsarr(&jsobj, "pauseBreakpoints"); |
180 // TODO(rmacnak): If we are paused at more than one breakpoint, | 192 // TODO(rmacnak): If we are paused at more than one breakpoint, |
181 // provide it here. | 193 // provide it here. |
182 if (breakpoint() != NULL) { | 194 if (breakpoint() != NULL) { |
183 jsarr.AddValue(breakpoint()); | 195 jsarr.AddValue(breakpoint()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } else { | 261 } else { |
250 jsobj->AddProperty("isolate", isolate()); | 262 jsobj->AddProperty("isolate", isolate()); |
251 } | 263 } |
252 ASSERT(timestamp_ != -1); | 264 ASSERT(timestamp_ != -1); |
253 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); | 265 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
254 } | 266 } |
255 | 267 |
256 #endif // !PRODUCT | 268 #endif // !PRODUCT |
257 | 269 |
258 } // namespace dart | 270 } // namespace dart |
OLD | NEW |