| 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" |
| 11 #include "vm/object_id_ring.h" | 11 #include "vm/object_id_ring.h" |
| 12 #include "vm/os_thread.h" | 12 #include "vm/os_thread.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 class Array; | 16 class Array; |
| 17 class EmbedderServiceHandler; | 17 class EmbedderServiceHandler; |
| 18 class Error; |
| 18 class GCEvent; | 19 class GCEvent; |
| 19 class GrowableObjectArray; | 20 class GrowableObjectArray; |
| 20 class Instance; | 21 class Instance; |
| 21 class Isolate; | 22 class Isolate; |
| 22 class JSONStream; | 23 class JSONStream; |
| 23 class Object; | 24 class Object; |
| 24 class RawInstance; | 25 class RawInstance; |
| 25 class ServiceEvent; | 26 class ServiceEvent; |
| 26 class String; | 27 class String; |
| 27 | 28 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 static void SendLogEvent(Isolate* isolate, | 114 static void SendLogEvent(Isolate* isolate, |
| 114 int64_t sequence_number, | 115 int64_t sequence_number, |
| 115 int64_t timestamp, | 116 int64_t timestamp, |
| 116 intptr_t level, | 117 intptr_t level, |
| 117 const String& name, | 118 const String& name, |
| 118 const String& message, | 119 const String& message, |
| 119 const Instance& zone, | 120 const Instance& zone, |
| 120 const Object& error, | 121 const Object& error, |
| 121 const Instance& stack_trace); | 122 const Instance& stack_trace); |
| 122 | 123 |
| 124 static void PostError(const String& method_name, |
| 125 const Array& parameter_keys, |
| 126 const Array& parameter_values, |
| 127 const Instance& reply_port, |
| 128 const Instance& id, |
| 129 const Error& error); |
| 130 |
| 123 // Well-known streams. | 131 // Well-known streams. |
| 124 static StreamInfo isolate_stream; | 132 static StreamInfo isolate_stream; |
| 125 static StreamInfo debug_stream; | 133 static StreamInfo debug_stream; |
| 126 static StreamInfo gc_stream; | 134 static StreamInfo gc_stream; |
| 127 static StreamInfo echo_stream; | 135 static StreamInfo echo_stream; |
| 128 static StreamInfo graph_stream; | 136 static StreamInfo graph_stream; |
| 129 static StreamInfo logging_stream; | 137 static StreamInfo logging_stream; |
| 130 | 138 |
| 131 static bool ListenStream(const char* stream_id); | 139 static bool ListenStream(const char* stream_id); |
| 132 static void CancelStream(const char* stream_id); | 140 static void CancelStream(const char* stream_id); |
| 133 | 141 |
| 134 static Dart_ServiceStreamListenCallback stream_listen_callback() { | 142 static Dart_ServiceStreamListenCallback stream_listen_callback() { |
| 135 return stream_listen_callback_; | 143 return stream_listen_callback_; |
| 136 } | 144 } |
| 137 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { | 145 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { |
| 138 return stream_cancel_callback_; | 146 return stream_cancel_callback_; |
| 139 } | 147 } |
| 140 | 148 |
| 141 private: | 149 private: |
| 142 static void InvokeMethod(Isolate* isolate, const Array& message); | 150 static void InvokeMethod(Isolate* isolate, const Array& message); |
| 143 | 151 |
| 144 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 152 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
| 145 JSONStream* js); | 153 JSONStream* js); |
| 146 | 154 |
| 147 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 155 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
| 148 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 156 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
| 149 static bool ScheduleExtensionHandler(const String& name, | 157 static void ScheduleExtensionHandler(const Instance& handler, |
| 158 const String& method_name, |
| 150 const Array& parameter_keys, | 159 const Array& parameter_keys, |
| 151 const Array& parameter_values, | 160 const Array& parameter_values, |
| 152 const Instance& reply_port, | 161 const Instance& reply_port, |
| 153 const Instance& id); | 162 const Instance& id); |
| 154 static void SendEvent(const char* stream_id, | 163 static void SendEvent(const char* stream_id, |
| 155 const char* event_type, | 164 const char* event_type, |
| 156 const Object& eventMessage); | 165 const Object& eventMessage); |
| 157 | 166 |
| 158 // Does not take ownership of 'data'. | 167 // Does not take ownership of 'data'. |
| 159 static void SendEventWithData(const char* stream_id, | 168 static void SendEventWithData(const char* stream_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 174 static bool needs_isolate_events_; | 183 static bool needs_isolate_events_; |
| 175 static bool needs_debug_events_; | 184 static bool needs_debug_events_; |
| 176 static bool needs_gc_events_; | 185 static bool needs_gc_events_; |
| 177 static bool needs_echo_events_; | 186 static bool needs_echo_events_; |
| 178 static bool needs_graph_events_; | 187 static bool needs_graph_events_; |
| 179 }; | 188 }; |
| 180 | 189 |
| 181 } // namespace dart | 190 } // namespace dart |
| 182 | 191 |
| 183 #endif // VM_SERVICE_H_ | 192 #endif // VM_SERVICE_H_ |
| OLD | NEW |