OLD | NEW |
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 #ifndef RUNTIME_VM_SERVICE_EVENT_H_ | 5 #ifndef RUNTIME_VM_SERVICE_EVENT_H_ |
6 #define RUNTIME_VM_SERVICE_EVENT_H_ | 6 #define RUNTIME_VM_SERVICE_EVENT_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class ActivationFrame; | 13 class ActivationFrame; |
14 class Breakpoint; | 14 class Breakpoint; |
15 class Instance; | 15 class Instance; |
16 class Isolate; | 16 class Isolate; |
17 class Object; | 17 class Object; |
18 class StreamInfo; | 18 class StreamInfo; |
19 class String; | 19 class String; |
20 class TimelineEventBlock; | 20 class TimelineEventBlock; |
21 | 21 |
22 class ServiceEvent { | 22 class ServiceEvent { |
23 public: | 23 public: |
24 enum EventKind { | 24 enum EventKind { |
25 kVMUpdate, // VM identity information has changed | 25 kVMUpdate, // VM identity information has changed |
26 | 26 |
27 kIsolateStart, // New isolate has started | 27 kIsolateStart, // New isolate has started |
28 kIsolateRunnable, // Isolate is ready to run | 28 kIsolateRunnable, // Isolate is ready to run |
29 kIsolateExit, // Isolate has exited | 29 kIsolateExit, // Isolate has exited |
30 kIsolateUpdate, // Isolate identity information has changed | 30 kIsolateUpdate, // Isolate identity information has changed |
31 kIsolateReload, // Result of a reload request | 31 kIsolateReload, // Result of a reload request |
32 kIsolateSpawn, // Result of an isolate spawn request | 32 kIsolateSpawn, // Result of an isolate spawn request |
33 kServiceExtensionAdded, // A service extension was registered | 33 kServiceExtensionAdded, // A service extension was registered |
34 | 34 |
35 kPauseStart, // --pause-isolates-on-start | 35 kPauseStart, // --pause-isolates-on-start |
36 kPauseExit, // --pause-isolates-on-exit | 36 kPauseExit, // --pause-isolates-on-exit |
37 kPauseBreakpoint, | 37 kPauseBreakpoint, |
38 kPauseInterrupted, | 38 kPauseInterrupted, |
39 kPauseException, | 39 kPauseException, |
40 kPausePostRequest, // isolate is paused after a service request. | 40 kPausePostRequest, // isolate is paused after a service request. |
41 kNone, // isolate has not been made runnable yet. | 41 kNone, // isolate has not been made runnable yet. |
42 kResume, | 42 kResume, |
43 kBreakpointAdded, | 43 kBreakpointAdded, |
44 kBreakpointResolved, | 44 kBreakpointResolved, |
45 kBreakpointRemoved, | 45 kBreakpointRemoved, |
46 kInspect, | 46 kInspect, |
47 kDebuggerSettingsUpdate, | 47 kDebuggerSettingsUpdate, |
48 | 48 |
49 kGC, | 49 kGC, |
50 | 50 |
51 kEmbedder, | 51 kEmbedder, |
(...skipping 21 matching lines...) Expand all Loading... |
73 struct ExtensionEvent { | 73 struct ExtensionEvent { |
74 const String* event_kind; | 74 const String* event_kind; |
75 const String* event_data; | 75 const String* event_data; |
76 }; | 76 }; |
77 | 77 |
78 ServiceEvent(Isolate* isolate, EventKind event_kind); | 78 ServiceEvent(Isolate* isolate, EventKind event_kind); |
79 | 79 |
80 Isolate* isolate() const { return isolate_; } | 80 Isolate* isolate() const { return isolate_; } |
81 | 81 |
82 // Used by the C embedding api. | 82 // Used by the C embedding api. |
83 Dart_Port isolate_id() const { | 83 Dart_Port isolate_id() const { return isolate_->main_port(); } |
84 return isolate_->main_port(); | |
85 } | |
86 | 84 |
87 EventKind kind() const { return kind_; } | 85 EventKind kind() const { return kind_; } |
88 | 86 |
89 bool IsPause() const { | 87 bool IsPause() const { |
90 switch (kind()) { | 88 switch (kind()) { |
91 case kPauseStart: | 89 case kPauseStart: |
92 case kPauseExit: | 90 case kPauseExit: |
93 case kPauseBreakpoint: | 91 case kPauseBreakpoint: |
94 case kPauseInterrupted: | 92 case kPauseInterrupted: |
95 case kPauseException: | 93 case kPauseException: |
96 case kPausePostRequest: | 94 case kPausePostRequest: |
97 return true; | 95 return true; |
98 default: | 96 default: |
99 return false; | 97 return false; |
100 } | 98 } |
101 } | 99 } |
102 | 100 |
103 const char* embedder_kind() const { return embedder_kind_; } | 101 const char* embedder_kind() const { return embedder_kind_; } |
104 | 102 |
105 const char* KindAsCString() const; | 103 const char* KindAsCString() const; |
106 | 104 |
107 void set_embedder_kind(const char* embedder_kind) { | 105 void set_embedder_kind(const char* embedder_kind) { |
108 embedder_kind_ = embedder_kind; | 106 embedder_kind_ = embedder_kind; |
109 } | 107 } |
110 | 108 |
111 const StreamInfo* stream_info() const; | 109 const StreamInfo* stream_info() const; |
112 const char* stream_id() const; | 110 const char* stream_id() const; |
113 | 111 |
114 void set_embedder_stream_id(const char* stream_id) { | 112 void set_embedder_stream_id(const char* stream_id) { |
115 embedder_stream_id_ = stream_id; | 113 embedder_stream_id_ = stream_id; |
116 } | 114 } |
117 | 115 |
118 Breakpoint* breakpoint() const { | 116 Breakpoint* breakpoint() const { return breakpoint_; } |
119 return breakpoint_; | |
120 } | |
121 void set_breakpoint(Breakpoint* bpt) { | 117 void set_breakpoint(Breakpoint* bpt) { |
122 ASSERT(kind() == kPauseBreakpoint || | 118 ASSERT(kind() == kPauseBreakpoint || kind() == kBreakpointAdded || |
123 kind() == kBreakpointAdded || | 119 kind() == kBreakpointResolved || kind() == kBreakpointRemoved); |
124 kind() == kBreakpointResolved || | |
125 kind() == kBreakpointRemoved); | |
126 breakpoint_ = bpt; | 120 breakpoint_ = bpt; |
127 } | 121 } |
128 | 122 |
129 ActivationFrame* top_frame() const { | 123 ActivationFrame* top_frame() const { return top_frame_; } |
130 return top_frame_; | |
131 } | |
132 void set_top_frame(ActivationFrame* frame) { | 124 void set_top_frame(ActivationFrame* frame) { |
133 ASSERT(kind() == kPauseBreakpoint || | 125 ASSERT(kind() == kPauseBreakpoint || kind() == kPauseInterrupted || |
134 kind() == kPauseInterrupted || | 126 kind() == kPauseException || kind() == kPausePostRequest || |
135 kind() == kPauseException || | |
136 kind() == kPausePostRequest || | |
137 kind() == kResume); | 127 kind() == kResume); |
138 top_frame_ = frame; | 128 top_frame_ = frame; |
139 } | 129 } |
140 | 130 |
141 const String* extension_rpc() const { | 131 const String* extension_rpc() const { return extension_rpc_; } |
142 return extension_rpc_; | |
143 } | |
144 void set_extension_rpc(const String* extension_rpc) { | 132 void set_extension_rpc(const String* extension_rpc) { |
145 extension_rpc_ = extension_rpc; | 133 extension_rpc_ = extension_rpc; |
146 } | 134 } |
147 | 135 |
148 const Object* exception() const { | 136 const Object* exception() const { return exception_; } |
149 return exception_; | |
150 } | |
151 void set_exception(const Object* exception) { | 137 void set_exception(const Object* exception) { |
152 ASSERT(kind_ == kPauseException); | 138 ASSERT(kind_ == kPauseException); |
153 exception_ = exception; | 139 exception_ = exception; |
154 } | 140 } |
155 | 141 |
156 const Error* reload_error() const { | 142 const Error* reload_error() const { |
157 ASSERT(kind_ == kIsolateReload); | 143 ASSERT(kind_ == kIsolateReload); |
158 return reload_error_; | 144 return reload_error_; |
159 } | 145 } |
160 void set_reload_error(const Error* error) { | 146 void set_reload_error(const Error* error) { |
(...skipping 12 matching lines...) Expand all Loading... |
173 | 159 |
174 const String* spawn_error() const { | 160 const String* spawn_error() const { |
175 ASSERT(kind_ == kIsolateSpawn); | 161 ASSERT(kind_ == kIsolateSpawn); |
176 return spawn_error_; | 162 return spawn_error_; |
177 } | 163 } |
178 void set_spawn_error(const String* error) { | 164 void set_spawn_error(const String* error) { |
179 ASSERT(kind_ == kIsolateSpawn); | 165 ASSERT(kind_ == kIsolateSpawn); |
180 spawn_error_ = error; | 166 spawn_error_ = error; |
181 } | 167 } |
182 | 168 |
183 bool at_async_jump() const { | 169 bool at_async_jump() const { return at_async_jump_; } |
184 return at_async_jump_; | 170 void set_at_async_jump(bool value) { at_async_jump_ = value; } |
185 } | |
186 void set_at_async_jump(bool value) { | |
187 at_async_jump_ = value; | |
188 } | |
189 | 171 |
190 const Object* inspectee() const { | 172 const Object* inspectee() const { return inspectee_; } |
191 return inspectee_; | |
192 } | |
193 void set_inspectee(const Object* inspectee) { | 173 void set_inspectee(const Object* inspectee) { |
194 ASSERT(kind_ == kInspect); | 174 ASSERT(kind_ == kInspect); |
195 inspectee_ = inspectee; | 175 inspectee_ = inspectee; |
196 } | 176 } |
197 | 177 |
198 const Heap::GCStats* gc_stats() const { | 178 const Heap::GCStats* gc_stats() const { return gc_stats_; } |
199 return gc_stats_; | |
200 } | |
201 | 179 |
202 void set_gc_stats(const Heap::GCStats* gc_stats) { | 180 void set_gc_stats(const Heap::GCStats* gc_stats) { gc_stats_ = gc_stats; } |
203 gc_stats_ = gc_stats; | |
204 } | |
205 | 181 |
206 const uint8_t* bytes() const { | 182 const uint8_t* bytes() const { return bytes_; } |
207 return bytes_; | |
208 } | |
209 | 183 |
210 intptr_t bytes_length() const { | 184 intptr_t bytes_length() const { return bytes_length_; } |
211 return bytes_length_; | |
212 } | |
213 | 185 |
214 void set_bytes(const uint8_t* bytes, intptr_t bytes_length) { | 186 void set_bytes(const uint8_t* bytes, intptr_t bytes_length) { |
215 bytes_ = bytes; | 187 bytes_ = bytes; |
216 bytes_length_ = bytes_length; | 188 bytes_length_ = bytes_length; |
217 } | 189 } |
218 | 190 |
219 void set_log_record(const LogRecord& log_record) { | 191 void set_log_record(const LogRecord& log_record) { log_record_ = log_record; } |
220 log_record_ = log_record; | |
221 } | |
222 | 192 |
223 void set_extension_event(const ExtensionEvent& extension_event) { | 193 void set_extension_event(const ExtensionEvent& extension_event) { |
224 extension_event_ = extension_event; | 194 extension_event_ = extension_event; |
225 } | 195 } |
226 | 196 |
227 void UpdateTimestamp(); | 197 void UpdateTimestamp(); |
228 | 198 |
229 int64_t timestamp() const { | 199 int64_t timestamp() const { return timestamp_; } |
230 return timestamp_; | |
231 } | |
232 | 200 |
233 const TimelineEventBlock* timeline_event_block() const { | 201 const TimelineEventBlock* timeline_event_block() const { |
234 return timeline_event_block_; | 202 return timeline_event_block_; |
235 } | 203 } |
236 | 204 |
237 void set_timeline_event_block(const TimelineEventBlock* block) { | 205 void set_timeline_event_block(const TimelineEventBlock* block) { |
238 ASSERT(kind() == kTimelineEvents); | 206 ASSERT(kind() == kTimelineEvents); |
239 timeline_event_block_ = block; | 207 timeline_event_block_ = block; |
240 } | 208 } |
241 | 209 |
(...skipping 20 matching lines...) Expand all Loading... |
262 const uint8_t* bytes_; | 230 const uint8_t* bytes_; |
263 intptr_t bytes_length_; | 231 intptr_t bytes_length_; |
264 LogRecord log_record_; | 232 LogRecord log_record_; |
265 ExtensionEvent extension_event_; | 233 ExtensionEvent extension_event_; |
266 int64_t timestamp_; | 234 int64_t timestamp_; |
267 }; | 235 }; |
268 | 236 |
269 } // namespace dart | 237 } // namespace dart |
270 | 238 |
271 #endif // RUNTIME_VM_SERVICE_EVENT_H_ | 239 #endif // RUNTIME_VM_SERVICE_EVENT_H_ |
OLD | NEW |