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 reload_error_(NULL), |
| 26 spawn_token_(NULL), |
| 27 spawn_error_(NULL), |
26 at_async_jump_(false), | 28 at_async_jump_(false), |
27 inspectee_(NULL), | 29 inspectee_(NULL), |
28 gc_stats_(NULL), | 30 gc_stats_(NULL), |
29 bytes_(NULL), | 31 bytes_(NULL), |
30 bytes_length_(0), | 32 bytes_length_(0), |
31 timestamp_(OS::GetCurrentTimeMillis()) { | 33 timestamp_(OS::GetCurrentTimeMillis()) { |
32 // We should never generate events for the vm or service isolates. | 34 // We should never generate events for the vm or service isolates. |
33 ASSERT(isolate_ != Dart::vm_isolate()); | 35 ASSERT(isolate_ != Dart::vm_isolate()); |
34 ASSERT(isolate == NULL || | 36 ASSERT(isolate == NULL || |
35 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); | 37 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)); |
(...skipping 26 matching lines...) Expand all Loading... |
62 case kIsolateRunnable: | 64 case kIsolateRunnable: |
63 return "IsolateRunnable"; | 65 return "IsolateRunnable"; |
64 case kIsolateExit: | 66 case kIsolateExit: |
65 return "IsolateExit"; | 67 return "IsolateExit"; |
66 case kIsolateUpdate: | 68 case kIsolateUpdate: |
67 return "IsolateUpdate"; | 69 return "IsolateUpdate"; |
68 case kServiceExtensionAdded: | 70 case kServiceExtensionAdded: |
69 return "ServiceExtensionAdded"; | 71 return "ServiceExtensionAdded"; |
70 case kIsolateReload: | 72 case kIsolateReload: |
71 return "IsolateReload"; | 73 return "IsolateReload"; |
| 74 case kIsolateSpawn: |
| 75 return "IsolateSpawn"; |
72 case kPauseStart: | 76 case kPauseStart: |
73 return "PauseStart"; | 77 return "PauseStart"; |
74 case kPauseExit: | 78 case kPauseExit: |
75 return "PauseExit"; | 79 return "PauseExit"; |
76 case kPauseBreakpoint: | 80 case kPauseBreakpoint: |
77 return "PauseBreakpoint"; | 81 return "PauseBreakpoint"; |
78 case kPauseInterrupted: | 82 case kPauseInterrupted: |
79 return "PauseInterrupted"; | 83 return "PauseInterrupted"; |
80 case kPauseException: | 84 case kPauseException: |
81 return "PauseException"; | 85 return "PauseException"; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const StreamInfo* ServiceEvent::stream_info() const { | 119 const StreamInfo* ServiceEvent::stream_info() const { |
116 switch (kind()) { | 120 switch (kind()) { |
117 case kVMUpdate: | 121 case kVMUpdate: |
118 return &Service::vm_stream; | 122 return &Service::vm_stream; |
119 | 123 |
120 case kIsolateStart: | 124 case kIsolateStart: |
121 case kIsolateRunnable: | 125 case kIsolateRunnable: |
122 case kIsolateExit: | 126 case kIsolateExit: |
123 case kIsolateUpdate: | 127 case kIsolateUpdate: |
124 case kIsolateReload: | 128 case kIsolateReload: |
| 129 case kIsolateSpawn: |
125 case kServiceExtensionAdded: | 130 case kServiceExtensionAdded: |
126 return &Service::isolate_stream; | 131 return &Service::isolate_stream; |
127 | 132 |
128 case kPauseStart: | 133 case kPauseStart: |
129 case kPauseExit: | 134 case kPauseExit: |
130 case kPauseBreakpoint: | 135 case kPauseBreakpoint: |
131 case kPauseInterrupted: | 136 case kPauseInterrupted: |
132 case kPauseException: | 137 case kPauseException: |
133 case kNone: | 138 case kNone: |
134 case kResume: | 139 case kResume: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 JSONObject jsobj(js); | 181 JSONObject jsobj(js); |
177 PrintJSONHeader(&jsobj); | 182 PrintJSONHeader(&jsobj); |
178 if (kind() == kIsolateReload) { | 183 if (kind() == kIsolateReload) { |
179 if (reload_error_ == NULL) { | 184 if (reload_error_ == NULL) { |
180 jsobj.AddProperty("status", "success"); | 185 jsobj.AddProperty("status", "success"); |
181 } else { | 186 } else { |
182 jsobj.AddProperty("status", "failure"); | 187 jsobj.AddProperty("status", "failure"); |
183 jsobj.AddProperty("reloadError", *(reload_error())); | 188 jsobj.AddProperty("reloadError", *(reload_error())); |
184 } | 189 } |
185 } | 190 } |
| 191 if (kind() == kIsolateSpawn) { |
| 192 ASSERT(spawn_token() != NULL); |
| 193 jsobj.AddPropertyStr("spawnToken", *(spawn_token())); |
| 194 if (spawn_error_ == NULL) { |
| 195 jsobj.AddProperty("status", "success"); |
| 196 } else { |
| 197 jsobj.AddProperty("status", "failure"); |
| 198 jsobj.AddPropertyStr("spawnError", *(spawn_error())); |
| 199 } |
| 200 } |
186 if (kind() == kServiceExtensionAdded) { | 201 if (kind() == kServiceExtensionAdded) { |
187 ASSERT(extension_rpc_ != NULL); | 202 ASSERT(extension_rpc_ != NULL); |
188 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString()); | 203 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString()); |
189 } | 204 } |
190 if (kind() == kPauseBreakpoint) { | 205 if (kind() == kPauseBreakpoint) { |
191 JSONArray jsarr(&jsobj, "pauseBreakpoints"); | 206 JSONArray jsarr(&jsobj, "pauseBreakpoints"); |
192 // TODO(rmacnak): If we are paused at more than one breakpoint, | 207 // TODO(rmacnak): If we are paused at more than one breakpoint, |
193 // provide it here. | 208 // provide it here. |
194 if (breakpoint() != NULL) { | 209 if (breakpoint() != NULL) { |
195 jsarr.AddValue(breakpoint()); | 210 jsarr.AddValue(breakpoint()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } else { | 276 } else { |
262 jsobj->AddProperty("isolate", isolate()); | 277 jsobj->AddProperty("isolate", isolate()); |
263 } | 278 } |
264 ASSERT(timestamp_ != -1); | 279 ASSERT(timestamp_ != -1); |
265 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); | 280 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
266 } | 281 } |
267 | 282 |
268 #endif // !PRODUCT | 283 #endif // !PRODUCT |
269 | 284 |
270 } // namespace dart | 285 } // namespace dart |
OLD | NEW |