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

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

Issue 2962593002: Added Editor stream and sendObjectToEditor RPC into Service Protocol (Closed)
Patch Set: Added explanation comment 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') | no next file » | 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";
114 default: 116 default:
115 UNREACHABLE(); 117 UNREACHABLE();
116 return "Unknown"; 118 return "Unknown";
117 } 119 }
118 } 120 }
119 121
120 122
121 const StreamInfo* ServiceEvent::stream_info() const { 123 const StreamInfo* ServiceEvent::stream_info() const {
122 switch (kind()) { 124 switch (kind()) {
123 case kVMUpdate: 125 case kVMUpdate:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 157
156 case kExtension: 158 case kExtension:
157 return &Service::extension_stream; 159 return &Service::extension_stream;
158 160
159 case kTimelineEvents: 161 case kTimelineEvents:
160 return &Service::timeline_stream; 162 return &Service::timeline_stream;
161 163
162 case kEmbedder: 164 case kEmbedder:
163 return NULL; 165 return NULL;
164 166
167 case kEditorObjectSelected:
168 return &Service::editor_stream;
169
165 default: 170 default:
166 UNREACHABLE(); 171 UNREACHABLE();
167 return NULL; 172 return NULL;
168 } 173 }
169 } 174 }
170 175
171 176
172 const char* ServiceEvent::stream_id() const { 177 const char* ServiceEvent::stream_id() const {
173 const StreamInfo* stream = stream_info(); 178 const StreamInfo* stream = stream_info();
174 if (stream == NULL) { 179 if (stream == NULL) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 logRecord.AddProperty("loggerName", *(log_record_.name)); 260 logRecord.AddProperty("loggerName", *(log_record_.name));
256 logRecord.AddProperty("message", *(log_record_.message)); 261 logRecord.AddProperty("message", *(log_record_.message));
257 logRecord.AddProperty("zone", *(log_record_.zone)); 262 logRecord.AddProperty("zone", *(log_record_.zone));
258 logRecord.AddProperty("error", *(log_record_.error)); 263 logRecord.AddProperty("error", *(log_record_.error));
259 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace)); 264 logRecord.AddProperty("stackTrace", *(log_record_.stack_trace));
260 } 265 }
261 if (kind() == kExtension) { 266 if (kind() == kExtension) {
262 js->AppendSerializedObject("extensionData", 267 js->AppendSerializedObject("extensionData",
263 extension_event_.event_data->ToCString()); 268 extension_event_.event_data->ToCString());
264 } 269 }
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 }
265 } 276 }
266 277
267 278
268 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { 279 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const {
269 ASSERT(jsobj != NULL); 280 ASSERT(jsobj != NULL);
270 jsobj->AddProperty("type", "Event"); 281 jsobj->AddProperty("type", "Event");
271 jsobj->AddProperty("kind", KindAsCString()); 282 jsobj->AddProperty("kind", KindAsCString());
272 if (kind() == kExtension) { 283 if (kind() == kExtension) {
273 ASSERT(extension_event_.event_kind != NULL); 284 ASSERT(extension_event_.event_kind != NULL);
274 jsobj->AddProperty("extensionKind", 285 jsobj->AddProperty("extensionKind",
275 extension_event_.event_kind->ToCString()); 286 extension_event_.event_kind->ToCString());
276 } 287 }
277 if (isolate() == NULL) { 288 if (isolate() == NULL) {
278 jsobj->AddPropertyVM("vm"); 289 jsobj->AddPropertyVM("vm");
279 } else { 290 } else {
280 jsobj->AddProperty("isolate", isolate()); 291 jsobj->AddProperty("isolate", isolate());
281 } 292 }
282 ASSERT(timestamp_ != -1); 293 ASSERT(timestamp_ != -1);
283 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); 294 jsobj->AddPropertyTimeMillis("timestamp", timestamp_);
284 } 295 }
285 296
286 #endif // !PRODUCT 297 #endif // !PRODUCT
287 298
288 } // namespace dart 299 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698