| 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_JSON_STREAM_H_ | 5 #ifndef VM_JSON_STREAM_H_ |
| 6 #define VM_JSON_STREAM_H_ | 6 #define VM_JSON_STREAM_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" // for Dart_Port | 8 #include "include/dart_api.h" // for Dart_Port |
| 9 #include "platform/text_buffer.h" | 9 #include "platform/text_buffer.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| 11 #include "vm/service.h" | 11 #include "vm/service.h" |
| 12 #include "vm/token_position.h" |
| 12 | 13 |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 class Array; | 17 class Array; |
| 17 class Breakpoint; | 18 class Breakpoint; |
| 18 class BreakpointLocation; | 19 class BreakpointLocation; |
| 19 class Field; | 20 class Field; |
| 20 class GrowableObjectArray; | 21 class GrowableObjectArray; |
| 21 class Instance; | 22 class Instance; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void PrintValueTimeMillis(int64_t millis); | 149 void PrintValueTimeMillis(int64_t millis); |
| 149 void PrintValueTimeMicros(int64_t micros); | 150 void PrintValueTimeMicros(int64_t micros); |
| 150 void PrintValue(double d); | 151 void PrintValue(double d); |
| 151 void PrintValueBase64(const uint8_t* bytes, intptr_t length); | 152 void PrintValueBase64(const uint8_t* bytes, intptr_t length); |
| 152 void PrintValue(const char* s); | 153 void PrintValue(const char* s); |
| 153 void PrintValue(const char* s, intptr_t len); | 154 void PrintValue(const char* s, intptr_t len); |
| 154 void PrintValueNoEscape(const char* s); | 155 void PrintValueNoEscape(const char* s); |
| 155 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 156 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 156 void PrintValue(const Object& o, bool ref = true); | 157 void PrintValue(const Object& o, bool ref = true); |
| 157 void PrintValue(Breakpoint* bpt); | 158 void PrintValue(Breakpoint* bpt); |
| 159 void PrintValue(TokenPosition tp); |
| 158 void PrintValue(const ServiceEvent* event); | 160 void PrintValue(const ServiceEvent* event); |
| 159 void PrintValue(Metric* metric); | 161 void PrintValue(Metric* metric); |
| 160 void PrintValue(MessageQueue* queue); | 162 void PrintValue(MessageQueue* queue); |
| 161 void PrintValue(Isolate* isolate, bool ref = true); | 163 void PrintValue(Isolate* isolate, bool ref = true); |
| 162 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); | 164 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); |
| 163 void PrintValue(TimelineEvent* timeline_event); | 165 void PrintValue(TimelineEvent* timeline_event); |
| 164 void PrintValueVM(bool ref = true); | 166 void PrintValueVM(bool ref = true); |
| 165 | 167 |
| 166 void PrintServiceId(const Object& o); | 168 void PrintServiceId(const Object& o); |
| 167 void PrintPropertyBool(const char* name, bool b); | 169 void PrintPropertyBool(const char* name, bool b); |
| 168 void PrintProperty(const char* name, intptr_t i); | 170 void PrintProperty(const char* name, intptr_t i); |
| 169 void PrintProperty64(const char* name, int64_t i); | 171 void PrintProperty64(const char* name, int64_t i); |
| 170 void PrintPropertyTimeMillis(const char* name, int64_t millis); | 172 void PrintPropertyTimeMillis(const char* name, int64_t millis); |
| 171 void PrintPropertyTimeMicros(const char* name, int64_t micros); | 173 void PrintPropertyTimeMicros(const char* name, int64_t micros); |
| 172 void PrintProperty(const char* name, double d); | 174 void PrintProperty(const char* name, double d); |
| 173 void PrintPropertyBase64(const char* name, | 175 void PrintPropertyBase64(const char* name, |
| 174 const uint8_t* bytes, | 176 const uint8_t* bytes, |
| 175 intptr_t length); | 177 intptr_t length); |
| 176 void PrintProperty(const char* name, const char* s); | 178 void PrintProperty(const char* name, const char* s); |
| 177 bool PrintPropertyStr(const char* name, const String& s, | 179 bool PrintPropertyStr(const char* name, const String& s, |
| 178 intptr_t offset, intptr_t count); | 180 intptr_t offset, intptr_t count); |
| 179 void PrintPropertyNoEscape(const char* name, const char* s); | 181 void PrintPropertyNoEscape(const char* name, const char* s); |
| 180 void PrintfProperty(const char* name, const char* format, ...) | 182 void PrintfProperty(const char* name, const char* format, ...) |
| 181 PRINTF_ATTRIBUTE(3, 4); | 183 PRINTF_ATTRIBUTE(3, 4); |
| 182 void PrintProperty(const char* name, const Object& o, bool ref = true); | 184 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 183 | 185 |
| 184 void PrintProperty(const char* name, const ServiceEvent* event); | 186 void PrintProperty(const char* name, const ServiceEvent* event); |
| 185 void PrintProperty(const char* name, Breakpoint* bpt); | 187 void PrintProperty(const char* name, Breakpoint* bpt); |
| 188 void PrintProperty(const char* name, TokenPosition tp); |
| 186 void PrintProperty(const char* name, Metric* metric); | 189 void PrintProperty(const char* name, Metric* metric); |
| 187 void PrintProperty(const char* name, MessageQueue* queue); | 190 void PrintProperty(const char* name, MessageQueue* queue); |
| 188 void PrintProperty(const char* name, Isolate* isolate); | 191 void PrintProperty(const char* name, Isolate* isolate); |
| 189 void PrintProperty(const char* name, TimelineEvent* timeline_event); | 192 void PrintProperty(const char* name, TimelineEvent* timeline_event); |
| 190 void PrintPropertyVM(const char* name, bool ref = true); | 193 void PrintPropertyVM(const char* name, bool ref = true); |
| 191 void PrintPropertyName(const char* name); | 194 void PrintPropertyName(const char* name); |
| 192 void PrintCommaIfNeeded(); | 195 void PrintCommaIfNeeded(); |
| 193 bool NeedComma(); | 196 bool NeedComma(); |
| 194 | 197 |
| 195 bool AddDartString(const String& s, intptr_t offset, intptr_t count); | 198 bool AddDartString(const String& s, intptr_t offset, intptr_t count); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ~JSONObject() { | 237 ~JSONObject() { |
| 235 stream_->CloseObject(); | 238 stream_->CloseObject(); |
| 236 } | 239 } |
| 237 | 240 |
| 238 void AddServiceId(const Object& o) const { | 241 void AddServiceId(const Object& o) const { |
| 239 stream_->PrintServiceId(o); | 242 stream_->PrintServiceId(o); |
| 240 } | 243 } |
| 241 | 244 |
| 242 void AddFixedServiceId(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 245 void AddFixedServiceId(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 243 | 246 |
| 244 void AddLocation(const Script& script, | 247 void AddLocation( |
| 245 intptr_t token_pos, | 248 const Script& script, |
| 246 intptr_t end_token_pos = -1) const; | 249 TokenPosition token_pos, |
| 250 TokenPosition end_token_pos = TokenPosition::kNoSource) const; |
| 247 | 251 |
| 248 void AddLocation(const BreakpointLocation* bpt_loc) const; | 252 void AddLocation(const BreakpointLocation* bpt_loc) const; |
| 249 | 253 |
| 250 void AddUnresolvedLocation(const BreakpointLocation* bpt_loc) const; | 254 void AddUnresolvedLocation(const BreakpointLocation* bpt_loc) const; |
| 251 | 255 |
| 252 void AddProperty(const char* name, bool b) const { | 256 void AddProperty(const char* name, bool b) const { |
| 253 stream_->PrintPropertyBool(name, b); | 257 stream_->PrintPropertyBool(name, b); |
| 254 } | 258 } |
| 255 void AddProperty(const char* name, intptr_t i) const { | 259 void AddProperty(const char* name, intptr_t i) const { |
| 256 stream_->PrintProperty(name, i); | 260 stream_->PrintProperty(name, i); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 286 } | 290 } |
| 287 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 291 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
| 288 stream_->PrintProperty(name, obj, ref); | 292 stream_->PrintProperty(name, obj, ref); |
| 289 } | 293 } |
| 290 void AddProperty(const char* name, const ServiceEvent* event) const { | 294 void AddProperty(const char* name, const ServiceEvent* event) const { |
| 291 stream_->PrintProperty(name, event); | 295 stream_->PrintProperty(name, event); |
| 292 } | 296 } |
| 293 void AddProperty(const char* name, Breakpoint* bpt) const { | 297 void AddProperty(const char* name, Breakpoint* bpt) const { |
| 294 stream_->PrintProperty(name, bpt); | 298 stream_->PrintProperty(name, bpt); |
| 295 } | 299 } |
| 300 void AddProperty(const char* name, TokenPosition tp) const { |
| 301 stream_->PrintProperty(name, tp); |
| 302 } |
| 296 void AddProperty(const char* name, Metric* metric) const { | 303 void AddProperty(const char* name, Metric* metric) const { |
| 297 stream_->PrintProperty(name, metric); | 304 stream_->PrintProperty(name, metric); |
| 298 } | 305 } |
| 299 void AddProperty(const char* name, MessageQueue* queue) const { | 306 void AddProperty(const char* name, MessageQueue* queue) const { |
| 300 stream_->PrintProperty(name, queue); | 307 stream_->PrintProperty(name, queue); |
| 301 } | 308 } |
| 302 void AddProperty(const char* name, Isolate* isolate) const { | 309 void AddProperty(const char* name, Isolate* isolate) const { |
| 303 stream_->PrintProperty(name, isolate); | 310 stream_->PrintProperty(name, isolate); |
| 304 } | 311 } |
| 305 void AddProperty(const char* name, TimelineEvent* timeline_event) const { | 312 void AddProperty(const char* name, TimelineEvent* timeline_event) const { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 void AddValue(const char* s) const { stream_->PrintValue(s); } | 357 void AddValue(const char* s) const { stream_->PrintValue(s); } |
| 351 void AddValue(const Object& obj, bool ref = true) const { | 358 void AddValue(const Object& obj, bool ref = true) const { |
| 352 stream_->PrintValue(obj, ref); | 359 stream_->PrintValue(obj, ref); |
| 353 } | 360 } |
| 354 void AddValue(Isolate* isolate, bool ref = true) const { | 361 void AddValue(Isolate* isolate, bool ref = true) const { |
| 355 stream_->PrintValue(isolate, ref); | 362 stream_->PrintValue(isolate, ref); |
| 356 } | 363 } |
| 357 void AddValue(Breakpoint* bpt) const { | 364 void AddValue(Breakpoint* bpt) const { |
| 358 stream_->PrintValue(bpt); | 365 stream_->PrintValue(bpt); |
| 359 } | 366 } |
| 367 void AddValue(TokenPosition tp) const { |
| 368 stream_->PrintValue(tp); |
| 369 } |
| 360 void AddValue(const ServiceEvent* event) const { | 370 void AddValue(const ServiceEvent* event) const { |
| 361 stream_->PrintValue(event); | 371 stream_->PrintValue(event); |
| 362 } | 372 } |
| 363 void AddValue(Metric* metric) const { | 373 void AddValue(Metric* metric) const { |
| 364 stream_->PrintValue(metric); | 374 stream_->PrintValue(metric); |
| 365 } | 375 } |
| 366 void AddValue(MessageQueue* queue) const { | 376 void AddValue(MessageQueue* queue) const { |
| 367 stream_->PrintValue(queue); | 377 stream_->PrintValue(queue); |
| 368 } | 378 } |
| 369 void AddValue(TimelineEvent* timeline_event) const { | 379 void AddValue(TimelineEvent* timeline_event) const { |
| 370 stream_->PrintValue(timeline_event); | 380 stream_->PrintValue(timeline_event); |
| 371 } | 381 } |
| 372 void AddValueVM(bool ref = true) const { | 382 void AddValueVM(bool ref = true) const { |
| 373 stream_->PrintValueVM(ref); | 383 stream_->PrintValueVM(ref); |
| 374 } | 384 } |
| 375 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 385 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 376 | 386 |
| 377 private: | 387 private: |
| 378 JSONStream* stream_; | 388 JSONStream* stream_; |
| 379 | 389 |
| 380 friend class JSONObject; | 390 friend class JSONObject; |
| 381 | 391 |
| 382 DISALLOW_ALLOCATION(); | 392 DISALLOW_ALLOCATION(); |
| 383 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 393 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 384 }; | 394 }; |
| 385 | 395 |
| 386 } // namespace dart | 396 } // namespace dart |
| 387 | 397 |
| 388 #endif // VM_JSON_STREAM_H_ | 398 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |