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

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

Issue 1965823002: Initial isolate reload support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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/message_handler.h" 7 #include "vm/message_handler.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 27 matching lines...) Expand all
38 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind) 38 ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind)
39 : isolate_(isolate), 39 : isolate_(isolate),
40 kind_(event_kind), 40 kind_(event_kind),
41 embedder_kind_(NULL), 41 embedder_kind_(NULL),
42 embedder_stream_id_(NULL), 42 embedder_stream_id_(NULL),
43 breakpoint_(NULL), 43 breakpoint_(NULL),
44 top_frame_(NULL), 44 top_frame_(NULL),
45 timeline_event_block_(NULL), 45 timeline_event_block_(NULL),
46 extension_rpc_(NULL), 46 extension_rpc_(NULL),
47 exception_(NULL), 47 exception_(NULL),
48 reload_error_(NULL),
48 at_async_jump_(false), 49 at_async_jump_(false),
49 inspectee_(NULL), 50 inspectee_(NULL),
50 gc_stats_(NULL), 51 gc_stats_(NULL),
51 bytes_(NULL), 52 bytes_(NULL),
52 bytes_length_(0), 53 bytes_length_(0),
53 timestamp_(OS::GetCurrentTimeMillis()) { 54 timestamp_(OS::GetCurrentTimeMillis()) {
54 if ((event_kind == ServiceEvent::kPauseStart) && 55 if ((event_kind == ServiceEvent::kPauseStart) &&
55 !isolate->message_handler()->is_paused_on_start()) { 56 !isolate->message_handler()->is_paused_on_start()) {
56 // We will pause on start but the message handler lacks a valid 57 // We will pause on start but the message handler lacks a valid
57 // paused timestamp because we haven't paused yet. Use the current time. 58 // paused timestamp because we haven't paused yet. Use the current time.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 case kIsolateStart: 106 case kIsolateStart:
106 return "IsolateStart"; 107 return "IsolateStart";
107 case kIsolateRunnable: 108 case kIsolateRunnable:
108 return "IsolateRunnable"; 109 return "IsolateRunnable";
109 case kIsolateExit: 110 case kIsolateExit:
110 return "IsolateExit"; 111 return "IsolateExit";
111 case kIsolateUpdate: 112 case kIsolateUpdate:
112 return "IsolateUpdate"; 113 return "IsolateUpdate";
113 case kServiceExtensionAdded: 114 case kServiceExtensionAdded:
114 return "ServiceExtensionAdded"; 115 return "ServiceExtensionAdded";
116 case kIsolateReload:
117 return "IsolateReload";
115 case kPauseStart: 118 case kPauseStart:
116 return "PauseStart"; 119 return "PauseStart";
117 case kPauseExit: 120 case kPauseExit:
118 return "PauseExit"; 121 return "PauseExit";
119 case kPauseBreakpoint: 122 case kPauseBreakpoint:
120 return "PauseBreakpoint"; 123 return "PauseBreakpoint";
121 case kPauseInterrupted: 124 case kPauseInterrupted:
122 return "PauseInterrupted"; 125 return "PauseInterrupted";
123 case kPauseException: 126 case kPauseException:
124 return "PauseException"; 127 return "PauseException";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 160
158 const char* ServiceEvent::stream_id() const { 161 const char* ServiceEvent::stream_id() const {
159 switch (kind()) { 162 switch (kind()) {
160 case kVMUpdate: 163 case kVMUpdate:
161 return Service::vm_stream.id(); 164 return Service::vm_stream.id();
162 165
163 case kIsolateStart: 166 case kIsolateStart:
164 case kIsolateRunnable: 167 case kIsolateRunnable:
165 case kIsolateExit: 168 case kIsolateExit:
166 case kIsolateUpdate: 169 case kIsolateUpdate:
170 case kIsolateReload:
167 case kServiceExtensionAdded: 171 case kServiceExtensionAdded:
168 return Service::isolate_stream.id(); 172 return Service::isolate_stream.id();
169 173
170 case kPauseStart: 174 case kPauseStart:
171 case kPauseExit: 175 case kPauseExit:
172 case kPauseBreakpoint: 176 case kPauseBreakpoint:
173 case kPauseInterrupted: 177 case kPauseInterrupted:
174 case kPauseException: 178 case kPauseException:
175 case kNone: 179 case kNone:
176 case kResume: 180 case kResume:
(...skipping 22 matching lines...) Expand all
199 default: 203 default:
200 UNREACHABLE(); 204 UNREACHABLE();
201 return NULL; 205 return NULL;
202 } 206 }
203 } 207 }
204 208
205 209
206 void ServiceEvent::PrintJSON(JSONStream* js) const { 210 void ServiceEvent::PrintJSON(JSONStream* js) const {
207 JSONObject jsobj(js); 211 JSONObject jsobj(js);
208 PrintJSONHeader(&jsobj); 212 PrintJSONHeader(&jsobj);
213 if (kind() == kIsolateReload) {
214 if (reload_error_ == NULL) {
215 jsobj.AddProperty("status", "success");
216 } else {
217 jsobj.AddProperty("status", "failure");
218 jsobj.AddProperty("reloadError", *(reload_error()));
219 }
220 }
209 if (kind() == kServiceExtensionAdded) { 221 if (kind() == kServiceExtensionAdded) {
210 ASSERT(extension_rpc_ != NULL); 222 ASSERT(extension_rpc_ != NULL);
211 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString()); 223 jsobj.AddProperty("extensionRPC", extension_rpc_->ToCString());
212 } 224 }
213 if (kind() == kPauseBreakpoint) { 225 if (kind() == kPauseBreakpoint) {
214 JSONArray jsarr(&jsobj, "pauseBreakpoints"); 226 JSONArray jsarr(&jsobj, "pauseBreakpoints");
215 // TODO(rmacnak): If we are paused at more than one breakpoint, 227 // TODO(rmacnak): If we are paused at more than one breakpoint,
216 // provide it here. 228 // provide it here.
217 if (breakpoint() != NULL) { 229 if (breakpoint() != NULL) {
218 jsarr.AddValue(breakpoint()); 230 jsarr.AddValue(breakpoint());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } else { 296 } else {
285 jsobj->AddProperty("isolate", isolate()); 297 jsobj->AddProperty("isolate", isolate());
286 } 298 }
287 ASSERT(timestamp_ != -1); 299 ASSERT(timestamp_ != -1);
288 jsobj->AddPropertyTimeMillis("timestamp", timestamp_); 300 jsobj->AddPropertyTimeMillis("timestamp", timestamp_);
289 } 301 }
290 302
291 #endif // !PRODUCT 303 #endif // !PRODUCT
292 304
293 } // namespace dart 305 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698