52 : public ServiceIdZone {
53 public:
54 RingServiceIdZone();
55 virtual ~RingServiceIdZone();
56
57 void Init(ObjectIdRing* ring, ObjectIdRing::IdPolicy policy);
58
59
60 virtual char* GetServiceId(const Object& obj);
61
62 void set_policy(ObjectIdRing::IdPolicy policy) { policy_ =
policy; }
63
64 ObjectIdRing::IdPolicy
policy()
const {
return policy_; }
65
66 private:
67 ObjectIdRing* ring_;
68 ObjectIdRing::IdPolicy policy_;
69};
70
71class StreamInfo {
72 public:
73 explicit StreamInfo(const char* id)
74 : id_(
id), enabled_(0), include_private_members_(
false) {}
75
76 const char*
id()
const {
return id_; }
77
78 void set_enabled(
bool value) { enabled_ =
value ? 1 : 0; }
79 bool enabled() const { return enabled_ != 0; }
80
81 void set_include_private_members(bool value) {
82 include_private_members_ =
value;
83 }
84 bool include_private_members() const { return include_private_members_; }
85
86
87 static intptr_t enabled_offset() {
return OFFSET_OF(StreamInfo, enabled_); }
88
89 private:
90 const char* id_;
91 std::atomic<intptr_t> enabled_;
92 std::atomic<bool> include_private_members_;
93};
94
95class Service : public AllStatic {
96 public:
99
100
101 static ErrorPtr HandleRootMessage(
const Array&
message);
102
103
104
105 static ErrorPtr HandleObjectRootMessage(
const Array&
message);
106
107
108 static ErrorPtr HandleIsolateMessage(Isolate* isolate,
const Array&
message);
109
110 static void HandleEvent(ServiceEvent*
event,
bool enter_safepoint =
true);
111
112 static void RegisterIsolateEmbedderCallback(
116
117 static void RegisterRootEmbedderCallback(
const char*
name,
120
121 static void SetEmbedderInformationCallback(
123
124 static void SetEmbedderStreamCallbacks(
127
128 static void SetGetServiceAssetsCallback(
130
131 static void SendEchoEvent(Isolate* isolate,
const char*
text);
132 static void SendInspectEvent(Isolate* isolate, const Object& inspectee);
133
134 static void SendEmbedderEvent(Isolate* isolate,
135 const char* stream_id,
136 const char* event_kind,
137 const uint8_t* bytes,
138 intptr_t bytes_len);
139
140 static void SendLogEvent(Isolate* isolate,
141 int64_t sequence_number,
142 int64_t timestamp,
143 intptr_t level,
146 const Instance& zone,
148 const Instance& stack_trace);
149
150 static void SendExtensionEvent(Isolate* isolate,
151 const String& event_kind,
152 const String& event_data);
153
154
155 static void SendEventWithData(const char* stream_id,
157 intptr_t reservation,
158 const char* metadata,
159 intptr_t metadata_size,
160 uint8_t* data,
161 intptr_t data_size);
162
163 static void PostError(const String& method_name,
164 const Array& parameter_keys,
165 const Array& parameter_values,
166 const Instance& reply_port,
167 const Instance& id,
169
170
171 static void LogResponseSize(const char* method, JSONStream* js);
172
173
174
175 static bool EnableTimelineStreams(char* categories_list);
176
177
178 static StreamInfo vm_stream;
179 static StreamInfo isolate_stream;
180 static StreamInfo debug_stream;
181 static StreamInfo gc_stream;
182 static StreamInfo echo_stream;
183 static StreamInfo heapsnapshot_stream;
184 static StreamInfo logging_stream;
185 static StreamInfo extension_stream;
186 static StreamInfo timeline_stream;
187 static StreamInfo profiler_stream;
188
189 static bool ListenStream(const char* stream_id, bool include_privates);
190 static void CancelStream(const char* stream_id);
191
192 static ObjectPtr RequestAssets();
193
195 return stream_listen_callback_;
196 }
198 return stream_cancel_callback_;
199 }
200
201 static void PrintJSONForEmbedderInformation(JSONObject* jsobj);
202 static void PrintJSONForVM(JSONStream* js, bool ref);
203
204 static void CheckForPause(Isolate* isolate, JSONStream* stream);
205
206 static int64_t CurrentRSS();
207 static int64_t MaxRSS();
208
209 static void SetDartLibraryKernelForSources(const uint8_t* kernel_bytes,
210 intptr_t kernel_length);
211 static bool HasDartLibraryKernelForSources() {
212 return (dart_library_kernel_ != nullptr);
213 }
214
215 static const uint8_t* dart_library_kernel() { return dart_library_kernel_; }
216
217 static intptr_t dart_library_kernel_length() {
218 return dart_library_kernel_len_;
219 }
220
221 private:
222 static ErrorPtr InvokeMethod(Isolate* isolate,
224 bool parameters_are_dart_objects = false);
225
226 static void EmbedderHandleMessage(EmbedderServiceHandler* handler,
227 JSONStream* js);
228
229 static EmbedderServiceHandler* FindIsolateEmbedderHandler(
const char*
name);
230 static EmbedderServiceHandler* FindRootEmbedderHandler(
const char*
name);
231 static void ScheduleExtensionHandler(const Instance& handler,
232 const String& method_name,
233 const Array& parameter_keys,
234 const Array& parameter_values,
235 const Instance& reply_port,
236 const Instance& id);
237
238
239 static void SendEvent(const char* stream_id,
241 uint8_t* bytes,
242 intptr_t bytes_length);
243
244 static void PostEvent(IsolateGroup* isolate_group,
245 Isolate* isolate,
246 const char* stream_id,
247 const char* kind,
249 bool enter_safepoint);
250
251 static void PostEventImpl(IsolateGroup* isolate_group,
252 Isolate* isolate,
253 const char* stream_id,
254 const char* kind,
256
257 static ErrorPtr MaybePause(Isolate* isolate,
const Error&
error);
258
259 static EmbedderServiceHandler* isolate_service_handler_head_;
260 static EmbedderServiceHandler* root_service_handler_head_;
265
266 static void* service_response_size_log_file_;
267
268 static const uint8_t* dart_library_kernel_;
269 static intptr_t dart_library_kernel_len_;
270};
271
272
274 const char* str,
275 const GrowableObjectArray& elements);
276
277}
278
279#endif
ax::mojom::Event event_type
Dart_Handle(* Dart_GetVMServiceAssetsArchive)(void)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
intptr_t ParseJSONArray(Thread *thread, const char *str, const GrowableObjectArray &elements)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
#define OFFSET_OF(type, field)