| 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 VM_SERVICE_EVENT_H_ | 5 #ifndef VM_SERVICE_EVENT_H_ |
| 6 #define VM_SERVICE_EVENT_H_ | 6 #define VM_SERVICE_EVENT_H_ |
| 7 | 7 |
| 8 #include "vm/debugger.h" | 8 #include "vm/globals.h" |
| 9 | 9 #include "vm/heap.h" |
| 10 class DebuggerEvent; | |
| 11 class TimelineEventBlock; | |
| 12 | 10 |
| 13 namespace dart { | 11 namespace dart { |
| 14 | 12 |
| 13 class ActivationFrame; |
| 14 class Breakpoint; |
| 15 class Instance; |
| 16 class Isolate; |
| 17 class Object; |
| 18 class StreamInfo; |
| 19 class String; |
| 20 class TimelineEventBlock; |
| 21 |
| 15 class ServiceEvent { | 22 class ServiceEvent { |
| 16 public: | 23 public: |
| 17 enum EventKind { | 24 enum EventKind { |
| 18 kVMUpdate, // VM identity information has changed | 25 kVMUpdate, // VM identity information has changed |
| 19 | 26 |
| 20 kIsolateStart, // New isolate has started | 27 kIsolateStart, // New isolate has started |
| 21 kIsolateRunnable, // Isolate is ready to run | 28 kIsolateRunnable, // Isolate is ready to run |
| 22 kIsolateExit, // Isolate has exited | 29 kIsolateExit, // Isolate has exited |
| 23 kIsolateUpdate, // Isolate identity information has changed | 30 kIsolateUpdate, // Isolate identity information has changed |
| 24 | 31 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const Instance* stack_trace; | 68 const Instance* stack_trace; |
| 62 }; | 69 }; |
| 63 | 70 |
| 64 struct ExtensionEvent { | 71 struct ExtensionEvent { |
| 65 const String* event_kind; | 72 const String* event_kind; |
| 66 const String* event_data; | 73 const String* event_data; |
| 67 }; | 74 }; |
| 68 | 75 |
| 69 ServiceEvent(Isolate* isolate, EventKind event_kind); | 76 ServiceEvent(Isolate* isolate, EventKind event_kind); |
| 70 | 77 |
| 71 explicit ServiceEvent(const DebuggerEvent* debugger_event); | 78 Isolate* isolate() const { return isolate_; } |
| 72 | 79 |
| 73 Isolate* isolate() const { return isolate_; } | 80 // Used by the C embedding api. |
| 81 Dart_Port isolate_id() const { |
| 82 return isolate_->main_port(); |
| 83 } |
| 74 | 84 |
| 75 EventKind kind() const { return kind_; } | 85 EventKind kind() const { return kind_; } |
| 76 | 86 |
| 77 bool IsPause() const { | 87 bool IsPause() const { |
| 78 switch (kind()) { | 88 switch (kind()) { |
| 79 case kPauseStart: | 89 case kPauseStart: |
| 80 case kPauseExit: | 90 case kPauseExit: |
| 81 case kPauseBreakpoint: | 91 case kPauseBreakpoint: |
| 82 case kPauseInterrupted: | 92 case kPauseInterrupted: |
| 83 case kPauseException: | 93 case kPauseException: |
| 84 return true; | 94 return true; |
| 85 default: | 95 default: |
| 86 return false; | 96 return false; |
| 87 } | 97 } |
| 88 } | 98 } |
| 89 | 99 |
| 90 const char* embedder_kind() const { return embedder_kind_; } | 100 const char* embedder_kind() const { return embedder_kind_; } |
| 91 | 101 |
| 92 const char* KindAsCString() const; | 102 const char* KindAsCString() const; |
| 93 | 103 |
| 94 void set_embedder_kind(const char* embedder_kind) { | 104 void set_embedder_kind(const char* embedder_kind) { |
| 95 embedder_kind_ = embedder_kind; | 105 embedder_kind_ = embedder_kind; |
| 96 } | 106 } |
| 97 | 107 |
| 108 const StreamInfo* stream_info() const; |
| 98 const char* stream_id() const; | 109 const char* stream_id() const; |
| 99 | 110 |
| 100 void set_embedder_stream_id(const char* stream_id) { | 111 void set_embedder_stream_id(const char* stream_id) { |
| 101 embedder_stream_id_ = stream_id; | 112 embedder_stream_id_ = stream_id; |
| 102 } | 113 } |
| 103 | 114 |
| 104 Breakpoint* breakpoint() const { | 115 Breakpoint* breakpoint() const { |
| 105 return breakpoint_; | 116 return breakpoint_; |
| 106 } | 117 } |
| 107 void set_breakpoint(Breakpoint* bpt) { | 118 void set_breakpoint(Breakpoint* bpt) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 186 } |
| 176 | 187 |
| 177 void set_log_record(const LogRecord& log_record) { | 188 void set_log_record(const LogRecord& log_record) { |
| 178 log_record_ = log_record; | 189 log_record_ = log_record; |
| 179 } | 190 } |
| 180 | 191 |
| 181 void set_extension_event(const ExtensionEvent& extension_event) { | 192 void set_extension_event(const ExtensionEvent& extension_event) { |
| 182 extension_event_ = extension_event; | 193 extension_event_ = extension_event; |
| 183 } | 194 } |
| 184 | 195 |
| 196 void UpdateTimestamp(); |
| 197 |
| 185 int64_t timestamp() const { | 198 int64_t timestamp() const { |
| 186 return timestamp_; | 199 return timestamp_; |
| 187 } | 200 } |
| 188 | 201 |
| 189 const TimelineEventBlock* timeline_event_block() const { | 202 const TimelineEventBlock* timeline_event_block() const { |
| 190 return timeline_event_block_; | 203 return timeline_event_block_; |
| 191 } | 204 } |
| 192 | 205 |
| 193 void set_timeline_event_block(const TimelineEventBlock* block) { | 206 void set_timeline_event_block(const TimelineEventBlock* block) { |
| 194 ASSERT(kind() == kTimelineEvents); | 207 ASSERT(kind() == kTimelineEvents); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 215 const uint8_t* bytes_; | 228 const uint8_t* bytes_; |
| 216 intptr_t bytes_length_; | 229 intptr_t bytes_length_; |
| 217 LogRecord log_record_; | 230 LogRecord log_record_; |
| 218 ExtensionEvent extension_event_; | 231 ExtensionEvent extension_event_; |
| 219 int64_t timestamp_; | 232 int64_t timestamp_; |
| 220 }; | 233 }; |
| 221 | 234 |
| 222 } // namespace dart | 235 } // namespace dart |
| 223 | 236 |
| 224 #endif // VM_SERVICE_EVENT_H_ | 237 #endif // VM_SERVICE_EVENT_H_ |
| OLD | NEW |