Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: runtime/vm/service_event.cc

Issue 2980733003: Introduced support for external services registration in the ServiceProtocol (Closed)
Patch Set: Address comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/service_event.h ('k') | sdk/lib/vmservice/client.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case kLogging: 104 case kLogging:
105 return "_Logging"; 105 return "_Logging";
106 case kDebuggerSettingsUpdate: 106 case kDebuggerSettingsUpdate:
107 return "_DebuggerSettingsUpdate"; 107 return "_DebuggerSettingsUpdate";
108 case kIllegal: 108 case kIllegal:
109 return "Illegal"; 109 return "Illegal";
110 case kExtension: 110 case kExtension:
111 return "Extension"; 111 return "Extension";
112 case kTimelineEvents: 112 case kTimelineEvents:
113 return "TimelineEvents"; 113 return "TimelineEvents";
114 case kEditorObjectSelected:
115 return "_EditorObjectSelected";
116 default: 114 default:
117 UNREACHABLE(); 115 UNREACHABLE();
118 return "Unknown"; 116 return "Unknown";
119 } 117 }
120 } 118 }
121 119
122 120
123 const StreamInfo* ServiceEvent::stream_info() const { 121 const StreamInfo* ServiceEvent::stream_info() const {
124 switch (kind()) { 122 switch (kind()) {
125 case kVMUpdate: 123 case kVMUpdate:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 155
158 case kExtension: 156 case kExtension:
159 return &Service::extension_stream; 157 return &Service::extension_stream;
160 158
161 case kTimelineEvents: 159 case kTimelineEvents:
162 return &Service::timeline_stream; 160 return &Service::timeline_stream;
163 161
164 case kEmbedder: 162 case kEmbedder:
165 return NULL; 163 return NULL;
166 164
167 case kEditorObjectSelected:
168 return &Service::editor_stream;
169
170 default: 165 default:
171 UNREACHABLE(); 166 UNREACHABLE();
172 return NULL; 167 return NULL;
173 } 168 }
174 } 169 }
175 170
176 171
177 const char* ServiceEvent::stream_id() const { 172 const char* ServiceEvent::stream_id() const {
178 const StreamInfo* stream = stream_info(); 173 const StreamInfo* stream = stream_info();
179 if (stream == NULL) { 174 if (stream == NULL) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 logRecord.AddProperty("loggerName", *(log_record_.name)); 255 logRecord.AddProperty("loggerName", *(log_record_.name));
261 logRecord.AddProperty("message", *(log_record_.message)); 256 logRecord.AddProperty("message", *(log_record_.message));
262 logRecord.AddProperty("zone", *(log_record_.zone)); 257 logRecord.AddProperty("zone", *(log_record_.zone));
263 logRecord.AddProperty("error", *(log_record_.error)); 258 logRecord.AddProperty("error", *(log_record_.error));
264 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace)); 259 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace));
265 } 260 }
266 if (kind() == kExtension) { 261 if (kind() == kExtension) {
267 js->AppendSerializedObject("extensionData", 262 js->AppendSerializedObject("extensionData",
268 extension_event_.event_data->ToCString()); 263 extension_event_.event_data->ToCString());
269 } 264 }
270 if (kind() == kEditorObjectSelected) {
271 if (editor_event_.object != NULL) {
272 jsobj.AddProperty("editor", editor_event_.editor);
273 jsobj.AddProperty("object", *(editor_event_.object));
274 }
275 }
276 } 265 }
277 266
278 267
279 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { 268 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const {
280 ASSERT(jsobj != NULL); 269 ASSERT(jsobj != NULL);
281 jsobj->AddProperty("type", "Event"); 270 jsobj->AddProperty("type", "Event");
282 jsobj->AddProperty("kind", KindAsCString()); 271 jsobj->AddProperty("kind", KindAsCString());
283 if (kind() == kExtension) { 272 if (kind() == kExtension) {
284 ASSERT(extension_event_.event_kind != NULL); 273 ASSERT(extension_event_.event_kind != NULL);
285 jsobj->AddProperty("extensionKind", 274 jsobj->AddProperty("extensionKind",
286 extension_event_.event_kind->ToCString()); 275 extension_event_.event_kind->ToCString());
287 } 276 }
288 if (isolate() == NULL) { 277 if (isolate() == NULL) {
289 jsobj->AddPropertyVM("vm"); 278 jsobj->AddPropertyVM("vm");
290 } else { 279 } else {
291 jsobj->AddProperty("isolate", isolate()); 280 jsobj->AddProperty("isolate", isolate());
292 } 281 }
293 ASSERT(timestamp_ != -1); 282 ASSERT(timestamp_ != -1);
294 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); 283 jsobj->AddPropertyTimeMillis("timestamp", timestamp_);
295 } 284 }
296 285
297 #endif // !PRODUCT 286 #endif // !PRODUCT
298 287
299 } // namespace dart 288 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_event.h ('k') | sdk/lib/vmservice/client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698