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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge 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.cc ('k') | runtime/vm/service_isolate.cc » ('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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // paused timestamp because we haven't paused yet. Use the current time. 42 // paused timestamp because we haven't paused yet. Use the current time.
43 timestamp_ = OS::GetCurrentTimeMillis(); 43 timestamp_ = OS::GetCurrentTimeMillis();
44 } else if ((event_kind == ServiceEvent::kPauseStart) || 44 } else if ((event_kind == ServiceEvent::kPauseStart) ||
45 (event_kind == ServiceEvent::kPauseExit)) { 45 (event_kind == ServiceEvent::kPauseExit)) {
46 timestamp_ = isolate->message_handler()->paused_timestamp(); 46 timestamp_ = isolate->message_handler()->paused_timestamp();
47 } else if (event_kind == ServiceEvent::kResume) { 47 } else if (event_kind == ServiceEvent::kResume) {
48 timestamp_ = isolate->last_resume_timestamp(); 48 timestamp_ = isolate->last_resume_timestamp();
49 } 49 }
50 } 50 }
51 51
52
53 void ServiceEvent::UpdateTimestamp() { 52 void ServiceEvent::UpdateTimestamp() {
54 timestamp_ = OS::GetCurrentTimeMillis(); 53 timestamp_ = OS::GetCurrentTimeMillis();
55 } 54 }
56 55
57
58 const char* ServiceEvent::KindAsCString() const { 56 const char* ServiceEvent::KindAsCString() const {
59 switch (kind()) { 57 switch (kind()) {
60 case kVMUpdate: 58 case kVMUpdate:
61 return "VMUpdate"; 59 return "VMUpdate";
62 case kIsolateStart: 60 case kIsolateStart:
63 return "IsolateStart"; 61 return "IsolateStart";
64 case kIsolateRunnable: 62 case kIsolateRunnable:
65 return "IsolateRunnable"; 63 return "IsolateRunnable";
66 case kIsolateExit: 64 case kIsolateExit:
67 return "IsolateExit"; 65 return "IsolateExit";
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 case kTimelineEvents: 110 case kTimelineEvents:
113 return "TimelineEvents"; 111 return "TimelineEvents";
114 case kEditorObjectSelected: 112 case kEditorObjectSelected:
115 return "_EditorObjectSelected"; 113 return "_EditorObjectSelected";
116 default: 114 default:
117 UNREACHABLE(); 115 UNREACHABLE();
118 return "Unknown"; 116 return "Unknown";
119 } 117 }
120 } 118 }
121 119
122
123 const StreamInfo* ServiceEvent::stream_info() const { 120 const StreamInfo* ServiceEvent::stream_info() const {
124 switch (kind()) { 121 switch (kind()) {
125 case kVMUpdate: 122 case kVMUpdate:
126 return &Service::vm_stream; 123 return &Service::vm_stream;
127 124
128 case kIsolateStart: 125 case kIsolateStart:
129 case kIsolateRunnable: 126 case kIsolateRunnable:
130 case kIsolateExit: 127 case kIsolateExit:
131 case kIsolateUpdate: 128 case kIsolateUpdate:
132 case kIsolateReload: 129 case kIsolateReload:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 163
167 case kEditorObjectSelected: 164 case kEditorObjectSelected:
168 return &Service::editor_stream; 165 return &Service::editor_stream;
169 166
170 default: 167 default:
171 UNREACHABLE(); 168 UNREACHABLE();
172 return NULL; 169 return NULL;
173 } 170 }
174 } 171 }
175 172
176
177 const char* ServiceEvent::stream_id() const { 173 const char* ServiceEvent::stream_id() const {
178 const StreamInfo* stream = stream_info(); 174 const StreamInfo* stream = stream_info();
179 if (stream == NULL) { 175 if (stream == NULL) {
180 ASSERT(kind() == kEmbedder); 176 ASSERT(kind() == kEmbedder);
181 return embedder_stream_id_; 177 return embedder_stream_id_;
182 } else { 178 } else {
183 return stream->id(); 179 return stream->id();
184 } 180 }
185 } 181 }
186 182
187
188 void ServiceEvent::PrintJSON(JSONStream* js) const { 183 void ServiceEvent::PrintJSON(JSONStream* js) const {
189 JSONObject jsobj(js); 184 JSONObject jsobj(js);
190 PrintJSONHeader(&jsobj); 185 PrintJSONHeader(&jsobj);
191 if (kind() == kIsolateReload) { 186 if (kind() == kIsolateReload) {
192 if (reload_error_ == NULL) { 187 if (reload_error_ == NULL) {
193 jsobj.AddProperty("status", "success"); 188 jsobj.AddProperty("status", "success");
194 } else { 189 } else {
195 jsobj.AddProperty("status", "failure"); 190 jsobj.AddProperty("status", "failure");
196 jsobj.AddProperty("reloadError", *(reload_error())); 191 jsobj.AddProperty("reloadError", *(reload_error()));
197 } 192 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 extension_event_.event_data->ToCString()); 263 extension_event_.event_data->ToCString());
269 } 264 }
270 if (kind() == kEditorObjectSelected) { 265 if (kind() == kEditorObjectSelected) {
271 if (editor_event_.object != NULL) { 266 if (editor_event_.object != NULL) {
272 jsobj.AddProperty("editor", editor_event_.editor); 267 jsobj.AddProperty("editor", editor_event_.editor);
273 jsobj.AddProperty("object", *(editor_event_.object)); 268 jsobj.AddProperty("object", *(editor_event_.object));
274 } 269 }
275 } 270 }
276 } 271 }
277 272
278
279 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const { 273 void ServiceEvent::PrintJSONHeader(JSONObject* jsobj) const {
280 ASSERT(jsobj != NULL); 274 ASSERT(jsobj != NULL);
281 jsobj->AddProperty("type", "Event"); 275 jsobj->AddProperty("type", "Event");
282 jsobj->AddProperty("kind", KindAsCString()); 276 jsobj->AddProperty("kind", KindAsCString());
283 if (kind() == kExtension) { 277 if (kind() == kExtension) {
284 ASSERT(extension_event_.event_kind != NULL); 278 ASSERT(extension_event_.event_kind != NULL);
285 jsobj->AddProperty("extensionKind", 279 jsobj->AddProperty("extensionKind",
286 extension_event_.event_kind->ToCString()); 280 extension_event_.event_kind->ToCString());
287 } 281 }
288 if (isolate() == NULL) { 282 if (isolate() == NULL) {
289 jsobj->AddPropertyVM("vm"); 283 jsobj->AddPropertyVM("vm");
290 } else { 284 } else {
291 jsobj->AddProperty("isolate", isolate()); 285 jsobj->AddProperty("isolate", isolate());
292 } 286 }
293 ASSERT(timestamp_ != -1); 287 ASSERT(timestamp_ != -1);
294 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); 288 jsobj->AddPropertyTimeMillis("timestamp", timestamp_);
295 } 289 }
296 290
297 #endif // !PRODUCT 291 #endif // !PRODUCT
298 292
299 } // namespace dart 293 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/service_isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698