5#ifndef RUNTIME_VM_JSON_STREAM_H_
6#define RUNTIME_VM_JSON_STREAM_H_
20class BreakpointLocation;
22class GrowableObjectArray;
33class TimelineEventBlock;
86 bool parameters_are_dart_objects =
false);
89 void PrintError(intptr_t code,
const char* details_format, ...)
112 if (include_private_members_) {
130 const char*
GetParamKey(intptr_t i)
const {
return param_keys_[i]; }
139 bool ParamIs(
const char*
key,
const char* value)
const;
141 const char*
method()
const {
return method_; }
171 const char* serialized_object) {
179 void Clear() { writer_.
Clear(); }
183 void OpenObject(
const char* property_name =
nullptr) {
184 if (ignore_object_depth_ > 0 ||
186 ignore_object_depth_++;
192 if (ignore_object_depth_ > 0) {
193 ignore_object_depth_--;
198 void UncloseObject() {
204 void OpenArray(
const char* property_name =
nullptr) {
205 if (ignore_object_depth_ > 0 ||
207 ignore_object_depth_++;
213 if (ignore_object_depth_ > 0) {
214 ignore_object_depth_--;
227 void AppendBytesInBase64(
const uint8_t* bytes, intptr_t
length) {
232 void PrintValue(intptr_t i) { writer_.
PrintValue(i); }
233 void PrintValue64(int64_t i) { writer_.
PrintValue64(i); }
234 void PrintValueTimeMillis(int64_t millis) { writer_.
PrintValue64(millis); }
235 void PrintValueTimeMicros(int64_t micros) { writer_.
PrintValue64(micros); }
237 void PrintValueBase64(
const uint8_t* bytes, intptr_t
length) {
240 void PrintValue(
const char*
s) { writer_.
PrintValue(
s); }
242 bool PrintValueStr(
const String&
s, intptr_t
offset, intptr_t
count) {
246 void VPrintfValue(const
char*
format, va_list
args) {
250 void PrintValue(
const Object& o,
bool ref =
true);
251 void PrintValue(Breakpoint* bpt);
252 void PrintValue(TokenPosition tp);
253 void PrintValue(
const ServiceEvent*
event);
254 void PrintValue(Metric* metric);
255 void PrintValue(MessageQueue* queue);
256 void PrintValue(Isolate* isolate,
bool ref =
true);
257 void PrintValue(IsolateGroup* isolate,
bool ref =
true);
259 void PrintValue(
const TimelineEventBlock* timeline_event_block);
260 void PrintValueVM(
bool ref =
true);
262 void PrintServiceId(
const Object& o);
264#define PRIVATE_NAME_CHECK() \
265 if (!IsAllowableKey(name) || ignore_object_depth_ > 0) { \
269 void PrintPropertyBool(
const char*
name,
bool b) {
273 void PrintProperty(
const char*
name, intptr_t i) {
277 void PrintProperty64(
const char*
name, int64_t i) {
281 void PrintPropertyTimeMillis(
const char*
name, int64_t millis) {
285 void PrintPropertyTimeMicros(
const char*
name, int64_t micros) {
289 void PrintProperty(
const char*
name,
double d) {
293 void PrintPropertyBase64(
const char*
name,
294 const uint8_t* bytes,
299 void PrintProperty(
const char*
name,
const char*
s) {
303 bool PrintPropertyStr(
const char*
name,
312 void PrintPropertyNoEscape(
const char*
name,
const char*
s) {
316 void PrintfProperty(
const char*
name,
const char*
format, ...)
318 void VPrintfProperty(const
char*
name, const
char*
format, va_list
args) {
323#undef PRIVATE_NAME_CHECK
325 void PrintProperty(
const char*
name,
const Object& o,
bool ref =
true);
327 void PrintProperty(
const char*
name,
const ServiceEvent*
event);
328 void PrintProperty(
const char*
name, Breakpoint* bpt);
329 void PrintProperty(
const char*
name, TokenPosition tp);
330 void PrintProperty(
const char*
name, Metric* metric);
331 void PrintProperty(
const char*
name, MessageQueue* queue);
332 void PrintProperty(
const char*
name, Isolate* isolate);
333 void PrintProperty(
const char*
name, IsolateGroup* isolate_group);
334 void PrintProperty(
const char*
name, Zone* zone);
336 void PrintProperty(
const char*
name,
337 const TimelineEventBlock* timeline_event_block);
338 void PrintPropertyVM(
const char*
name,
bool ref =
true);
341 void AddEscapedUTF8String(
const char*
s, intptr_t len) {
347 RingServiceIdZone default_id_zone_;
348 ServiceIdZone* id_zone_;
351 Array* parameter_keys_;
352 Array* parameter_values_;
354 const char** param_keys_;
355 const char** param_values_;
356 intptr_t num_params_;
359 int64_t setup_time_micros_;
360 bool include_private_members_;
361 intptr_t ignore_object_depth_;
371 stream_->OpenObject();
374 stream_->OpenObject(
name);
396 stream_->PrintPropertyBool(
name,
b);
399 stream_->PrintProperty(
name, i);
402 stream_->PrintProperty64(
name, i);
405 stream_->PrintPropertyTimeMillis(
name, millis);
408 stream_->PrintPropertyTimeMicros(
name, micros);
411 stream_->PrintProperty(
name,
d);
414 const uint8_t* bytes,
416 stream_->PrintPropertyBase64(
name, bytes,
length);
419 stream_->PrintProperty(
name,
s);
424 intptr_t
count = -1)
const {
428 stream_->PrintPropertyNoEscape(
name,
s);
431 stream_->PrintProperty(
name, obj, ref);
437 stream_->PrintProperty(
name, bpt);
440 stream_->PrintProperty(
name, tp);
443 stream_->PrintProperty(
name, metric);
449 stream_->PrintProperty(
name, isolate);
452 stream_->PrintProperty(
name, isolate_group);
455 stream_->PrintProperty(
name, zone);
458 const TimelineEvent* timeline_event)
const {
459 stream_->PrintProperty(
name, timeline_event);
462 const TimelineEventBlock* timeline_event_block)
const {
463 stream_->PrintProperty(
name, timeline_event_block);
466 stream_->PrintPropertyVM(
name, ref);
476 DISALLOW_ALLOCATION();
483 stream_->OpenArray();
486 stream_->OpenArray(
name);
489 stream_->OpenArray();
495 void AddValue(intptr_t i)
const { stream_->PrintValue(i); }
496 void AddValue64(int64_t i)
const { stream_->PrintValue64(i); }
498 stream_->PrintValueTimeMillis(millis);
501 stream_->PrintValueTimeMicros(micros);
504 void AddValue(
const char*
s)
const { stream_->PrintValue(
s); }
506 stream_->PrintValue(obj, ref);
509 stream_->PrintValue(isolate, ref);
512 stream_->PrintValue(isolate_group, ref);
519 void AddValue(
const TimelineEvent* timeline_event)
const {
520 stream_->PrintValue(timeline_event);
522 void AddValue(
const TimelineEventBlock* timeline_event_block)
const {
523 stream_->PrintValue(timeline_event_block);
525 void AddValueVM(
bool ref =
true)
const { stream_->PrintValueVM(ref); }
533 DISALLOW_ALLOCATION();
540 : stream_(stream), queued_bytes_(), num_queued_bytes_(0) {
541 stream_->AppendBytes(
reinterpret_cast<const uint8_t*
>(
"\""), 1);
544 stream_->AppendBytesInBase64(queued_bytes_, num_queued_bytes_);
545 stream_->AppendBytes(
reinterpret_cast<const uint8_t*
>(
"\""), 1);
548 void AppendBytes(
const uint8_t* bytes, intptr_t
length);
552 uint8_t queued_bytes_[3];
553 intptr_t num_queued_bytes_;
555 DISALLOW_ALLOCATION();
void AddValue64(int64_t i) const
void AddValueTimeMicros(int64_t micros) const
void AddValue(const char *s) const
void AddValue(const TimelineEventBlock *timeline_event_block) const
JSONArray(JSONStream *stream)
void AddValue(double d) const
void AddValue(intptr_t i) const
JSONArray(const JSONObject *obj, const char *name)
void AddValueNull() const
void AddValue(const Object &obj, bool ref=true) const
JSONArray(const JSONArray *arr)
void AddValue(Metric *metric) const
void AddValue(Isolate *isolate, bool ref=true) const
void AddValueVM(bool ref=true) const
void AddValueTimeMillis(int64_t millis) const
void AddValue(const ServiceEvent *event) const
void AddValue(bool b) const
void AddValue(Breakpoint *bpt) const
void AddValue(IsolateGroup *isolate_group, bool ref=true) const
void AddValue(MessageQueue *queue) const
void AddValue(const TimelineEvent *timeline_event) const
void AddValue(TokenPosition tp) const
JSONBase64String(JSONStream *stream)
void AddPropertyVM(const char *name, bool ref=true) const
void void void AddLocation(const Script &script, TokenPosition token_pos, TokenPosition end_token_pos=TokenPosition::kNoSource) const
void AddProperty64(const char *name, int64_t i) const
void AddProperty(const char *name, const TimelineEvent *timeline_event) const
void AddProperty(const char *name, Zone *zone) const
void AddProperty(const char *name, bool b) const
void AddProperty(const char *name, TokenPosition tp) const
void AddServiceId(const Object &o) const
void AddPropertyBase64(const char *name, const uint8_t *bytes, intptr_t length) const
void AddProperty(const char *name, double d) const
void AddPropertyTimeMicros(const char *name, int64_t micros) const
void AddUnresolvedLocation(const BreakpointLocation *bpt_loc) const
bool AddPropertyStr(const char *name, const String &s, intptr_t offset=0, intptr_t count=-1) const
void AddProperty(const char *name, const char *s) const
void AddProperty(const char *name, Breakpoint *bpt) const
void AddProperty(const char *name, MessageQueue *queue) const
void AddPropertyNoEscape(const char *name, const char *s) const
void AddFixedServiceId(const char *format,...) const PRINTF_ATTRIBUTE(2
JSONObject(const JSONObject *obj, const char *name)
void AddProperty(const char *name, const TimelineEventBlock *timeline_event_block) const
JSONObject(JSONStream *stream)
void AddProperty(const char *name, Metric *metric) const
void AddPropertyTimeMillis(const char *name, int64_t millis) const
void AddProperty(const char *name, intptr_t i) const
void AddProperty(const char *name, Isolate *isolate) const
void AddPropertyF(const char *name, const char *format,...) const PRINTF_ATTRIBUTE(3
void AddProperty(const char *name, const ServiceEvent *event) const
void AddProperty(const char *name, IsolateGroup *isolate_group) const
void AddLocationLine(const Script &script, intptr_t line) const
void AddProperty(const char *name, const Object &obj, bool ref=true) const
void Setup(Zone *zone, Dart_Port reply_port, const Instance &seq, const String &method, const Array ¶m_keys, const Array ¶m_values, bool parameters_are_dart_objects=false)
void PrintCommaIfNeeded()
intptr_t num_params() const
ObjectPtr GetObjectParameterKey(intptr_t i) const
ObjectPtr LookupObjectParam(const char *key) const
void set_include_private_members(bool include_private_members)
bool ParamIs(const char *key, const char *value) const
bool include_private_members() const
void ComputeOffsetAndCount(intptr_t length, intptr_t *offset, intptr_t *count)
void AppendSerializedObject(const char *serialized_object)
Dart_Port reply_port() const
void AppendBytes(const uint8_t *buffer, intptr_t buffer_length)
bool HasParam(const char *key) const
const char * GetParamKey(intptr_t i) const
const char ** param_values() const
void set_offset(intptr_t value)
void set_reply_port(Dart_Port port)
void set_count(intptr_t value)
const char ** param_keys() const
intptr_t NumObjectParameters() const
void PrintError(intptr_t code, const char *details_format,...) PRINTF_ATTRIBUTE(3
ObjectPtr GetObjectParameterValue(intptr_t i) const
friend class TimelineEvent
const char * GetParamValue(intptr_t i) const
void Steal(char **buffer, intptr_t *buffer_length)
ServiceIdZone * id_zone()
const char * LookupParam(const char *key) const
const char * method() const
void SetParams(const char **param_keys, const char **param_values, intptr_t num_params)
void set_id_zone(ServiceIdZone *id_zone)
bool IsAllowableKey(const char *key)
void AppendSerializedObject(const char *property_name, const char *serialized_object)
void AppendBytesInBase64(const uint8_t *bytes, intptr_t length)
bool PrintPropertyStr(const char *name, const String &s, intptr_t offset=0, intptr_t count=-1)
void PrintPropertyBool(const char *name, bool b)
void PrintProperty64(const char *name, int64_t i)
void PrintPropertyBase64(const char *name, const uint8_t *bytes, intptr_t length)
void PrintCommaIfNeeded()
void Steal(char **buffer, intptr_t *buffer_length)
void PrintValue(intptr_t i)
void PrintValueBase64(const uint8_t *bytes, intptr_t length)
void PrintValueBool(bool b)
void PrintProperty(const char *name, intptr_t i)
void PrintPropertyName(const char *name)
void void VPrintfValue(const char *format, va_list args)
void OpenArray(const char *property_name=nullptr)
void AppendBytes(const uint8_t *buffer, intptr_t buffer_length)
bool PrintValueStr(const String &s, intptr_t offset, intptr_t count)
void AppendSerializedObject(const char *serialized_object)
void void VPrintfProperty(const char *name, const char *format, va_list args)
void AddEscapedUTF8String(const char *s)
void PrintValueNoEscape(const char *s)
void OpenObject(const char *property_name=nullptr)
void PrintValue64(int64_t i)
void PrintPropertyNoEscape(const char *name, const char *s)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
#define PRIVATE_NAME_CHECK()
@ kExpressionCompilationError
@ kServiceAlreadyRegistered
@ kIsolateMustHaveReloaded
@ kStreamAlreadySubscribed
@ kFileSystemDoesNotExist
@ kFileSystemAlreadyExists
@ kInvalidTimelineRequest