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

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

Issue 1166433008: 2nd attempt at adding streamListen/streamCancel to the service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cleanups before review Created 5 years, 6 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 namespace dart { 7 namespace dart {
8 8
9 // Translate from the legacy DebugEvent to a ServiceEvent. 9 // Translate from the legacy DebugEvent to a ServiceEvent.
10 static ServiceEvent::EventType TranslateEventType( 10 static ServiceEvent::EventType TranslateEventType(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 case kBreakpointAdded: 77 case kBreakpointAdded:
78 return "BreakpointAdded"; 78 return "BreakpointAdded";
79 case kBreakpointResolved: 79 case kBreakpointResolved:
80 return "BreakpointResolved"; 80 return "BreakpointResolved";
81 case kBreakpointRemoved: 81 case kBreakpointRemoved:
82 return "BreakpointRemoved"; 82 return "BreakpointRemoved";
83 case kGC: 83 case kGC:
84 return "GC"; // TODO(koda): Change to GarbageCollected. 84 return "GC"; // TODO(koda): Change to GarbageCollected.
85 case kInspect: 85 case kInspect:
86 return "Inspect"; 86 return "Inspect";
87 case kIllegal:
88 return "Illegal";
87 default: 89 default:
88 UNREACHABLE(); 90 UNREACHABLE();
89 return "Unknown"; 91 return "Unknown";
90 } 92 }
91 } 93 }
92 94
93 95
96 const char* ServiceEvent::stream_id() const {
97 switch (type()) {
98 case kIsolateStart:
99 case kIsolateExit:
100 case kIsolateUpdate:
101 return "Isolate";
102
103 case kPauseStart:
104 case kPauseExit:
105 case kPauseBreakpoint:
106 case kPauseInterrupted:
107 case kPauseException:
108 case kResume:
109 case kBreakpointAdded:
110 case kBreakpointResolved:
111 case kBreakpointRemoved:
112 case kInspect:
113 return "Debug";
114
115 case kGC:
116 return "GC";
117
118 default:
119 UNREACHABLE();
120 return NULL;
121 }
122 }
123
124
94 void ServiceEvent::PrintJSON(JSONStream* js) const { 125 void ServiceEvent::PrintJSON(JSONStream* js) const {
95 JSONObject jsobj(js); 126 JSONObject jsobj(js);
96 jsobj.AddProperty("type", "Event"); 127 jsobj.AddProperty("type", "Event");
97 jsobj.AddProperty("kind", EventTypeToCString(type())); 128 jsobj.AddProperty("kind", EventTypeToCString(type()));
98 jsobj.AddProperty("isolate", isolate()); 129 jsobj.AddProperty("isolate", isolate());
99 if (breakpoint() != NULL) { 130 if (breakpoint() != NULL) {
100 jsobj.AddProperty("breakpoint", breakpoint()); 131 jsobj.AddProperty("breakpoint", breakpoint());
101 } 132 }
102 if (top_frame() != NULL) { 133 if (top_frame() != NULL) {
103 JSONObject jsFrame(&jsobj, "topFrame"); 134 JSONObject jsFrame(&jsobj, "topFrame");
104 top_frame()->PrintToJSONObject(&jsFrame); 135 top_frame()->PrintToJSONObject(&jsFrame);
105 intptr_t index = 0; // Avoid ambiguity in call to AddProperty. 136 intptr_t index = 0; // Avoid ambiguity in call to AddProperty.
106 jsFrame.AddProperty("index", index); 137 jsFrame.AddProperty("index", index);
107 } 138 }
108 if (exception() != NULL) { 139 if (exception() != NULL) {
109 jsobj.AddProperty("exception", *(exception())); 140 jsobj.AddProperty("exception", *(exception()));
110 } 141 }
111 if (inspectee() != NULL) { 142 if (inspectee() != NULL) {
112 jsobj.AddProperty("inspectee", *(inspectee())); 143 jsobj.AddProperty("inspectee", *(inspectee()));
113 } 144 }
114 if (gc_stats() != NULL) { 145 if (gc_stats() != NULL) {
115 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); 146 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_));
116 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); 147 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj);
117 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); 148 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj);
118 } 149 }
119 } 150 }
120 151
121 } // namespace dart 152 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698