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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 case kInspect: | 128 case kInspect: |
129 return "Inspect"; | 129 return "Inspect"; |
130 case kEmbedder: | 130 case kEmbedder: |
131 return embedder_kind(); | 131 return embedder_kind(); |
132 case kLogging: | 132 case kLogging: |
133 return "_Logging"; | 133 return "_Logging"; |
134 case kDebuggerSettingsUpdate: | 134 case kDebuggerSettingsUpdate: |
135 return "_DebuggerSettingsUpdate"; | 135 return "_DebuggerSettingsUpdate"; |
136 case kIllegal: | 136 case kIllegal: |
137 return "Illegal"; | 137 return "Illegal"; |
| 138 case kExtension: |
| 139 return "Extension"; |
138 default: | 140 default: |
139 UNREACHABLE(); | 141 UNREACHABLE(); |
140 return "Unknown"; | 142 return "Unknown"; |
141 } | 143 } |
142 } | 144 } |
143 | 145 |
144 | 146 |
145 const char* ServiceEvent::stream_id() const { | 147 const char* ServiceEvent::stream_id() const { |
146 switch (kind()) { | 148 switch (kind()) { |
147 case kVMUpdate: | 149 case kVMUpdate: |
(...skipping 21 matching lines...) Expand all Loading... |
169 | 171 |
170 case kGC: | 172 case kGC: |
171 return Service::gc_stream.id(); | 173 return Service::gc_stream.id(); |
172 | 174 |
173 case kEmbedder: | 175 case kEmbedder: |
174 return embedder_stream_id_; | 176 return embedder_stream_id_; |
175 | 177 |
176 case kLogging: | 178 case kLogging: |
177 return Service::logging_stream.id(); | 179 return Service::logging_stream.id(); |
178 | 180 |
| 181 case kExtension: |
| 182 return Service::extension_stream.id(); |
| 183 |
179 default: | 184 default: |
180 UNREACHABLE(); | 185 UNREACHABLE(); |
181 return NULL; | 186 return NULL; |
182 } | 187 } |
183 } | 188 } |
184 | 189 |
185 | 190 |
186 void ServiceEvent::PrintJSON(JSONStream* js) const { | 191 void ServiceEvent::PrintJSON(JSONStream* js) const { |
187 JSONObject jsobj(js); | 192 JSONObject jsobj(js); |
188 PrintJSONHeader(&jsobj); | 193 PrintJSONHeader(&jsobj); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 JSONObject logRecord(&jsobj, "logRecord"); | 239 JSONObject logRecord(&jsobj, "logRecord"); |
235 logRecord.AddProperty64("sequenceNumber", log_record_.sequence_number); | 240 logRecord.AddProperty64("sequenceNumber", log_record_.sequence_number); |
236 logRecord.AddPropertyTimeMillis("time", log_record_.timestamp); | 241 logRecord.AddPropertyTimeMillis("time", log_record_.timestamp); |
237 logRecord.AddProperty64("level", log_record_.level); | 242 logRecord.AddProperty64("level", log_record_.level); |
238 logRecord.AddProperty("loggerName", *(log_record_.name)); | 243 logRecord.AddProperty("loggerName", *(log_record_.name)); |
239 logRecord.AddProperty("message", *(log_record_.message)); | 244 logRecord.AddProperty("message", *(log_record_.message)); |
240 logRecord.AddProperty("zone", *(log_record_.zone)); | 245 logRecord.AddProperty("zone", *(log_record_.zone)); |
241 logRecord.AddProperty("error", *(log_record_.error)); | 246 logRecord.AddProperty("error", *(log_record_.error)); |
242 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace)); | 247 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace)); |
243 } | 248 } |
| 249 if (kind() == kExtension) { |
| 250 js->AppendSerializedObject("extensionData", |
| 251 extension_event_.event_data->ToCString()); |
| 252 } |
244 } | 253 } |
245 | 254 |
246 | 255 |
247 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { | 256 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { |
248 ASSERT(jsobj != NULL); | 257 ASSERT(jsobj != NULL); |
249 jsobj->AddProperty("type", "Event"); | 258 jsobj->AddProperty("type", "Event"); |
250 jsobj->AddProperty("kind", KindAsCString()); | 259 jsobj->AddProperty("kind", KindAsCString()); |
| 260 if (kind() == kExtension) { |
| 261 ASSERT(extension_event_.event_kind != NULL); |
| 262 jsobj->AddProperty("extensionKind", |
| 263 extension_event_.event_kind->ToCString()); |
| 264 } |
251 if (kind() == kVMUpdate) { | 265 if (kind() == kVMUpdate) { |
252 jsobj->AddPropertyVM("vm"); | 266 jsobj->AddPropertyVM("vm"); |
253 } else { | 267 } else { |
254 jsobj->AddProperty("isolate", isolate()); | 268 jsobj->AddProperty("isolate", isolate()); |
255 } | 269 } |
256 ASSERT(timestamp_ != -1); | 270 ASSERT(timestamp_ != -1); |
257 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); | 271 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); |
258 } | 272 } |
259 | 273 |
260 } // namespace dart | 274 } // namespace dart |
OLD | NEW |