OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_H_ | 5 #ifndef VM_SERVICE_H_ |
6 #define VM_SERVICE_H_ | 6 #define VM_SERVICE_H_ |
7 | 7 |
8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
9 | 9 |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static void SendEchoEvent(Isolate* isolate, const char* text); | 101 static void SendEchoEvent(Isolate* isolate, const char* text); |
102 static void SendGraphEvent(Isolate* isolate); | 102 static void SendGraphEvent(Isolate* isolate); |
103 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); | 103 static void SendInspectEvent(Isolate* isolate, const Object& inspectee); |
104 | 104 |
105 static void SendEmbedderEvent(Isolate* isolate, | 105 static void SendEmbedderEvent(Isolate* isolate, |
106 const char* stream_id, | 106 const char* stream_id, |
107 const char* event_kind, | 107 const char* event_kind, |
108 const uint8_t* bytes, | 108 const uint8_t* bytes, |
109 intptr_t bytes_len); | 109 intptr_t bytes_len); |
110 | 110 |
| 111 static void SendLogEvent(Isolate* isolate, |
| 112 int64_t sequence_number, |
| 113 int64_t timestamp, |
| 114 intptr_t level, |
| 115 const String& name, |
| 116 const String& message, |
| 117 const Instance& zone, |
| 118 const Object& error, |
| 119 const Instance& stack_trace); |
| 120 |
111 // Well-known streams. | 121 // Well-known streams. |
112 static StreamInfo isolate_stream; | 122 static StreamInfo isolate_stream; |
113 static StreamInfo debug_stream; | 123 static StreamInfo debug_stream; |
114 static StreamInfo gc_stream; | 124 static StreamInfo gc_stream; |
115 static StreamInfo echo_stream; | 125 static StreamInfo echo_stream; |
116 static StreamInfo graph_stream; | 126 static StreamInfo graph_stream; |
| 127 static StreamInfo logging_stream; |
117 | 128 |
118 static bool ListenStream(const char* stream_id); | 129 static bool ListenStream(const char* stream_id); |
119 static void CancelStream(const char* stream_id); | 130 static void CancelStream(const char* stream_id); |
120 | 131 |
121 static Dart_ServiceStreamListenCallback stream_listen_callback() { | 132 static Dart_ServiceStreamListenCallback stream_listen_callback() { |
122 return stream_listen_callback_; | 133 return stream_listen_callback_; |
123 } | 134 } |
124 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { | 135 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { |
125 return stream_cancel_callback_; | 136 return stream_cancel_callback_; |
126 } | 137 } |
127 | 138 |
128 private: | 139 private: |
129 static void InvokeMethod(Isolate* isolate, const Array& message); | 140 static void InvokeMethod(Isolate* isolate, const Array& message); |
130 | 141 |
131 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 142 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
132 JSONStream* js); | 143 JSONStream* js); |
133 | 144 |
134 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 145 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
135 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 146 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
136 | 147 |
137 static void SendEvent(const char* stream_id, | 148 static void SendEvent(const char* stream_id, |
138 const char* event_type, | 149 const char* event_type, |
139 const Object& eventMessage); | 150 const Object& eventMessage); |
| 151 |
140 // Does not take ownership of 'data'. | 152 // Does not take ownership of 'data'. |
141 static void SendEventWithData(const char* stream_id, | 153 static void SendEventWithData(const char* stream_id, |
142 const char* event_type, | 154 const char* event_type, |
143 const String& meta, | 155 const String& meta, |
144 const uint8_t* data, | 156 const uint8_t* data, |
145 intptr_t size); | 157 intptr_t size); |
146 | 158 |
| 159 static void PostEvent(const char* stream_id, |
| 160 const char* kind, |
| 161 JSONStream* event); |
| 162 |
147 static EmbedderServiceHandler* isolate_service_handler_head_; | 163 static EmbedderServiceHandler* isolate_service_handler_head_; |
148 static EmbedderServiceHandler* root_service_handler_head_; | 164 static EmbedderServiceHandler* root_service_handler_head_; |
149 static Dart_ServiceStreamListenCallback stream_listen_callback_; | 165 static Dart_ServiceStreamListenCallback stream_listen_callback_; |
150 static Dart_ServiceStreamCancelCallback stream_cancel_callback_; | 166 static Dart_ServiceStreamCancelCallback stream_cancel_callback_; |
151 | 167 |
152 static bool needs_isolate_events_; | 168 static bool needs_isolate_events_; |
153 static bool needs_debug_events_; | 169 static bool needs_debug_events_; |
154 static bool needs_gc_events_; | 170 static bool needs_gc_events_; |
155 static bool needs_echo_events_; | 171 static bool needs_echo_events_; |
156 static bool needs_graph_events_; | 172 static bool needs_graph_events_; |
157 }; | 173 }; |
158 | 174 |
159 } // namespace dart | 175 } // namespace dart |
160 | 176 |
161 #endif // VM_SERVICE_H_ | 177 #endif // VM_SERVICE_H_ |
OLD | NEW |