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 RUNTIME_VM_SERVICE_H_ | 5 #ifndef RUNTIME_VM_SERVICE_H_ |
6 #define RUNTIME_VM_SERVICE_H_ | 6 #define RUNTIME_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_graph.h" | 11 #include "vm/object_graph.h" |
12 #include "vm/object_id_ring.h" | 12 #include "vm/object_id_ring.h" |
13 #include "vm/os_thread.h" | 13 #include "vm/os_thread.h" |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 #define SERVICE_PROTOCOL_MAJOR_VERSION 3 | 17 #define SERVICE_PROTOCOL_MAJOR_VERSION 3 |
18 #define SERVICE_PROTOCOL_MINOR_VERSION 5 | 18 #define SERVICE_PROTOCOL_MINOR_VERSION 5 |
19 | 19 |
20 class Array; | 20 class Array; |
21 class EmbedderServiceHandler; | 21 class EmbedderServiceHandler; |
22 class Error; | 22 class Error; |
23 class GCEvent; | 23 class GCEvent; |
24 class GrowableObjectArray; | 24 class GrowableObjectArray; |
25 class Instance; | 25 class Instance; |
26 class Isolate; | 26 class Isolate; |
27 class JSONStream; | 27 class JSONStream; |
28 class JSONObject; | |
29 class Object; | 28 class Object; |
30 class RawInstance; | 29 class RawInstance; |
31 class RawError; | 30 class RawError; |
32 class ServiceEvent; | 31 class ServiceEvent; |
33 class String; | 32 class String; |
34 | 33 |
35 class ServiceIdZone { | 34 class ServiceIdZone { |
36 public: | 35 public: |
37 ServiceIdZone(); | 36 ServiceIdZone(); |
38 virtual ~ServiceIdZone(); | 37 virtual ~ServiceIdZone(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 93 |
95 static void RegisterIsolateEmbedderCallback( | 94 static void RegisterIsolateEmbedderCallback( |
96 const char* name, | 95 const char* name, |
97 Dart_ServiceRequestCallback callback, | 96 Dart_ServiceRequestCallback callback, |
98 void* user_data); | 97 void* user_data); |
99 | 98 |
100 static void RegisterRootEmbedderCallback(const char* name, | 99 static void RegisterRootEmbedderCallback(const char* name, |
101 Dart_ServiceRequestCallback callback, | 100 Dart_ServiceRequestCallback callback, |
102 void* user_data); | 101 void* user_data); |
103 | 102 |
104 static void SetEmbedderInformationCallback( | |
105 Dart_EmbedderInformationCallback callback); | |
106 | |
107 static void SetEmbedderStreamCallbacks( | 103 static void SetEmbedderStreamCallbacks( |
108 Dart_ServiceStreamListenCallback listen_callback, | 104 Dart_ServiceStreamListenCallback listen_callback, |
109 Dart_ServiceStreamCancelCallback cancel_callback); | 105 Dart_ServiceStreamCancelCallback cancel_callback); |
110 | 106 |
111 static void SetGetServiceAssetsCallback( | 107 static void SetGetServiceAssetsCallback( |
112 Dart_GetVMServiceAssetsArchive get_service_assets); | 108 Dart_GetVMServiceAssetsArchive get_service_assets); |
113 | 109 |
114 static void SendEchoEvent(Isolate* isolate, const char* text); | 110 static void SendEchoEvent(Isolate* isolate, const char* text); |
115 static void SendGraphEvent(Thread* thread, | 111 static void SendGraphEvent(Thread* thread, |
116 ObjectGraph::SnapshotRoots roots, | 112 ObjectGraph::SnapshotRoots roots, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 156 |
161 static RawObject* RequestAssets(); | 157 static RawObject* RequestAssets(); |
162 | 158 |
163 static Dart_ServiceStreamListenCallback stream_listen_callback() { | 159 static Dart_ServiceStreamListenCallback stream_listen_callback() { |
164 return stream_listen_callback_; | 160 return stream_listen_callback_; |
165 } | 161 } |
166 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { | 162 static Dart_ServiceStreamCancelCallback stream_cancel_callback() { |
167 return stream_cancel_callback_; | 163 return stream_cancel_callback_; |
168 } | 164 } |
169 | 165 |
170 static void PrintJSONForEmbedderInformation(JSONObject *jsobj); | |
171 static void PrintJSONForVM(JSONStream* js, bool ref); | 166 static void PrintJSONForVM(JSONStream* js, bool ref); |
172 | 167 |
173 static void CheckForPause(Isolate* isolate, JSONStream* stream); | 168 static void CheckForPause(Isolate* isolate, JSONStream* stream); |
174 | 169 |
175 static int64_t CurrentRSS(); | |
176 static int64_t MaxRSS(); | |
177 | |
178 private: | 170 private: |
179 static RawError* InvokeMethod(Isolate* isolate, | 171 static RawError* InvokeMethod(Isolate* isolate, |
180 const Array& message, | 172 const Array& message, |
181 bool parameters_are_dart_objects = false); | 173 bool parameters_are_dart_objects = false); |
182 | 174 |
183 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, | 175 static void EmbedderHandleMessage(EmbedderServiceHandler* handler, |
184 JSONStream* js); | 176 JSONStream* js); |
185 | 177 |
186 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); | 178 static EmbedderServiceHandler* FindIsolateEmbedderHandler(const char* name); |
187 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); | 179 static EmbedderServiceHandler* FindRootEmbedderHandler(const char* name); |
(...skipping 22 matching lines...) Expand all Loading... |
210 const char* kind, | 202 const char* kind, |
211 JSONStream* event); | 203 JSONStream* event); |
212 | 204 |
213 static RawError* MaybePause(Isolate* isolate, const Error& error); | 205 static RawError* MaybePause(Isolate* isolate, const Error& error); |
214 | 206 |
215 static EmbedderServiceHandler* isolate_service_handler_head_; | 207 static EmbedderServiceHandler* isolate_service_handler_head_; |
216 static EmbedderServiceHandler* root_service_handler_head_; | 208 static EmbedderServiceHandler* root_service_handler_head_; |
217 static Dart_ServiceStreamListenCallback stream_listen_callback_; | 209 static Dart_ServiceStreamListenCallback stream_listen_callback_; |
218 static Dart_ServiceStreamCancelCallback stream_cancel_callback_; | 210 static Dart_ServiceStreamCancelCallback stream_cancel_callback_; |
219 static Dart_GetVMServiceAssetsArchive get_service_assets_callback_; | 211 static Dart_GetVMServiceAssetsArchive get_service_assets_callback_; |
220 static Dart_EmbedderInformationCallback embedder_information_callback_; | |
221 | 212 |
222 static bool needs_isolate_events_; | 213 static bool needs_isolate_events_; |
223 static bool needs_debug_events_; | 214 static bool needs_debug_events_; |
224 static bool needs_gc_events_; | 215 static bool needs_gc_events_; |
225 static bool needs_echo_events_; | 216 static bool needs_echo_events_; |
226 static bool needs_graph_events_; | 217 static bool needs_graph_events_; |
227 }; | 218 }; |
228 | 219 |
229 } // namespace dart | 220 } // namespace dart |
230 | 221 |
231 #endif // RUNTIME_VM_SERVICE_H_ | 222 #endif // RUNTIME_VM_SERVICE_H_ |
OLD | NEW |