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_JSON_STREAM_H_ | 5 #ifndef RUNTIME_VM_JSON_STREAM_H_ |
6 #define RUNTIME_VM_JSON_STREAM_H_ | 6 #define RUNTIME_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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class JSONArray; | 23 class JSONArray; |
24 class JSONObject; | 24 class JSONObject; |
25 class MessageQueue; | 25 class MessageQueue; |
26 class Metric; | 26 class Metric; |
27 class Object; | 27 class Object; |
28 class Script; | 28 class Script; |
29 class ServiceEvent; | 29 class ServiceEvent; |
30 class String; | 30 class String; |
31 class TimelineEvent; | 31 class TimelineEvent; |
32 class TimelineEventBlock; | 32 class TimelineEventBlock; |
| 33 class Thread; |
| 34 class ThreadRegistry; |
33 class Zone; | 35 class Zone; |
34 | 36 |
35 | 37 |
36 // Keep this enum in sync with: | 38 // Keep this enum in sync with: |
37 // | 39 // |
38 // - runtime/vm/service/vmservice.dart | 40 // - runtime/vm/service/vmservice.dart |
39 // - runtime/observatory/lib/src/service/object.dart | 41 // - runtime/observatory/lib/src/service/object.dart |
40 // | 42 // |
41 enum JSONRpcErrorCode { | 43 enum JSONRpcErrorCode { |
42 kParseError = -32700, | 44 kParseError = -32700, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void PrintValue(const char* s, intptr_t len); | 176 void PrintValue(const char* s, intptr_t len); |
175 void PrintValueNoEscape(const char* s); | 177 void PrintValueNoEscape(const char* s); |
176 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 178 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
177 void PrintValue(const Object& o, bool ref = true); | 179 void PrintValue(const Object& o, bool ref = true); |
178 void PrintValue(Breakpoint* bpt); | 180 void PrintValue(Breakpoint* bpt); |
179 void PrintValue(TokenPosition tp); | 181 void PrintValue(TokenPosition tp); |
180 void PrintValue(const ServiceEvent* event); | 182 void PrintValue(const ServiceEvent* event); |
181 void PrintValue(Metric* metric); | 183 void PrintValue(Metric* metric); |
182 void PrintValue(MessageQueue* queue); | 184 void PrintValue(MessageQueue* queue); |
183 void PrintValue(Isolate* isolate, bool ref = true); | 185 void PrintValue(Isolate* isolate, bool ref = true); |
| 186 void PrintValue(ThreadRegistry* reg); |
| 187 void PrintValue(Thread* thread); |
| 188 void PrintValue(Zone* zone); |
184 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); | 189 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); |
185 void PrintValue(const TimelineEvent* timeline_event); | 190 void PrintValue(const TimelineEvent* timeline_event); |
186 void PrintValue(const TimelineEventBlock* timeline_event_block); | 191 void PrintValue(const TimelineEventBlock* timeline_event_block); |
187 void PrintValueVM(bool ref = true); | 192 void PrintValueVM(bool ref = true); |
188 | 193 |
189 void PrintServiceId(const Object& o); | 194 void PrintServiceId(const Object& o); |
190 void PrintPropertyBool(const char* name, bool b); | 195 void PrintPropertyBool(const char* name, bool b); |
191 void PrintProperty(const char* name, intptr_t i); | 196 void PrintProperty(const char* name, intptr_t i); |
192 void PrintProperty64(const char* name, int64_t i); | 197 void PrintProperty64(const char* name, int64_t i); |
193 void PrintPropertyTimeMillis(const char* name, int64_t millis); | 198 void PrintPropertyTimeMillis(const char* name, int64_t millis); |
(...skipping 11 matching lines...) Expand all Loading... |
205 void PrintfProperty(const char* name, const char* format, ...) | 210 void PrintfProperty(const char* name, const char* format, ...) |
206 PRINTF_ATTRIBUTE(3, 4); | 211 PRINTF_ATTRIBUTE(3, 4); |
207 void PrintProperty(const char* name, const Object& o, bool ref = true); | 212 void PrintProperty(const char* name, const Object& o, bool ref = true); |
208 | 213 |
209 void PrintProperty(const char* name, const ServiceEvent* event); | 214 void PrintProperty(const char* name, const ServiceEvent* event); |
210 void PrintProperty(const char* name, Breakpoint* bpt); | 215 void PrintProperty(const char* name, Breakpoint* bpt); |
211 void PrintProperty(const char* name, TokenPosition tp); | 216 void PrintProperty(const char* name, TokenPosition tp); |
212 void PrintProperty(const char* name, Metric* metric); | 217 void PrintProperty(const char* name, Metric* metric); |
213 void PrintProperty(const char* name, MessageQueue* queue); | 218 void PrintProperty(const char* name, MessageQueue* queue); |
214 void PrintProperty(const char* name, Isolate* isolate); | 219 void PrintProperty(const char* name, Isolate* isolate); |
| 220 void PrintProperty(const char* name, ThreadRegistry* reg); |
| 221 void PrintProperty(const char* name, Thread* thread); |
| 222 void PrintProperty(const char* name, Zone* zone); |
215 void PrintProperty(const char* name, const TimelineEvent* timeline_event); | 223 void PrintProperty(const char* name, const TimelineEvent* timeline_event); |
216 void PrintProperty(const char* name, | 224 void PrintProperty(const char* name, |
217 const TimelineEventBlock* timeline_event_block); | 225 const TimelineEventBlock* timeline_event_block); |
218 void PrintPropertyVM(const char* name, bool ref = true); | 226 void PrintPropertyVM(const char* name, bool ref = true); |
219 void PrintPropertyName(const char* name); | 227 void PrintPropertyName(const char* name); |
220 bool NeedComma(); | 228 bool NeedComma(); |
221 | 229 |
222 bool AddDartString(const String& s, intptr_t offset, intptr_t count); | 230 bool AddDartString(const String& s, intptr_t offset, intptr_t count); |
223 void AddEscapedUTF8String(const char* s); | 231 void AddEscapedUTF8String(const char* s); |
224 void AddEscapedUTF8String(const char* s, intptr_t len); | 232 void AddEscapedUTF8String(const char* s, intptr_t len); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 332 } |
325 void AddProperty(const char* name, Metric* metric) const { | 333 void AddProperty(const char* name, Metric* metric) const { |
326 stream_->PrintProperty(name, metric); | 334 stream_->PrintProperty(name, metric); |
327 } | 335 } |
328 void AddProperty(const char* name, MessageQueue* queue) const { | 336 void AddProperty(const char* name, MessageQueue* queue) const { |
329 stream_->PrintProperty(name, queue); | 337 stream_->PrintProperty(name, queue); |
330 } | 338 } |
331 void AddProperty(const char* name, Isolate* isolate) const { | 339 void AddProperty(const char* name, Isolate* isolate) const { |
332 stream_->PrintProperty(name, isolate); | 340 stream_->PrintProperty(name, isolate); |
333 } | 341 } |
| 342 void AddProperty(const char* name, ThreadRegistry* reg) const { |
| 343 stream_->PrintProperty(name, reg); |
| 344 } |
| 345 void AddProperty(const char* name, Thread* thread) const { |
| 346 stream_->PrintProperty(name, thread); |
| 347 } |
| 348 void AddProperty(const char* name, Zone* zone) const { |
| 349 stream_->PrintProperty(name, zone); |
| 350 } |
334 void AddProperty(const char* name, | 351 void AddProperty(const char* name, |
335 const TimelineEvent* timeline_event) const { | 352 const TimelineEvent* timeline_event) const { |
336 stream_->PrintProperty(name, timeline_event); | 353 stream_->PrintProperty(name, timeline_event); |
337 } | 354 } |
338 void AddProperty(const char* name, | 355 void AddProperty(const char* name, |
339 const TimelineEventBlock* timeline_event_block) const { | 356 const TimelineEventBlock* timeline_event_block) const { |
340 stream_->PrintProperty(name, timeline_event_block); | 357 stream_->PrintProperty(name, timeline_event_block); |
341 } | 358 } |
342 void AddPropertyVM(const char* name, bool ref = true) const { | 359 void AddPropertyVM(const char* name, bool ref = true) const { |
343 stream_->PrintPropertyVM(name, ref); | 360 stream_->PrintPropertyVM(name, ref); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 stream_->PrintValueTimeMicros(micros); | 396 stream_->PrintValueTimeMicros(micros); |
380 } | 397 } |
381 void AddValue(double d) const { stream_->PrintValue(d); } | 398 void AddValue(double d) const { stream_->PrintValue(d); } |
382 void AddValue(const char* s) const { stream_->PrintValue(s); } | 399 void AddValue(const char* s) const { stream_->PrintValue(s); } |
383 void AddValue(const Object& obj, bool ref = true) const { | 400 void AddValue(const Object& obj, bool ref = true) const { |
384 stream_->PrintValue(obj, ref); | 401 stream_->PrintValue(obj, ref); |
385 } | 402 } |
386 void AddValue(Isolate* isolate, bool ref = true) const { | 403 void AddValue(Isolate* isolate, bool ref = true) const { |
387 stream_->PrintValue(isolate, ref); | 404 stream_->PrintValue(isolate, ref); |
388 } | 405 } |
| 406 void AddValue(ThreadRegistry* reg) const { stream_->PrintValue(reg); } |
| 407 void AddValue(Thread* thread) const { stream_->PrintValue(thread); } |
| 408 void AddValue(Zone* zone) const { stream_->PrintValue(zone); } |
389 void AddValue(Breakpoint* bpt) const { stream_->PrintValue(bpt); } | 409 void AddValue(Breakpoint* bpt) const { stream_->PrintValue(bpt); } |
390 void AddValue(TokenPosition tp) const { stream_->PrintValue(tp); } | 410 void AddValue(TokenPosition tp) const { stream_->PrintValue(tp); } |
391 void AddValue(const ServiceEvent* event) const { stream_->PrintValue(event); } | 411 void AddValue(const ServiceEvent* event) const { stream_->PrintValue(event); } |
392 void AddValue(Metric* metric) const { stream_->PrintValue(metric); } | 412 void AddValue(Metric* metric) const { stream_->PrintValue(metric); } |
393 void AddValue(MessageQueue* queue) const { stream_->PrintValue(queue); } | 413 void AddValue(MessageQueue* queue) const { stream_->PrintValue(queue); } |
394 void AddValue(const TimelineEvent* timeline_event) const { | 414 void AddValue(const TimelineEvent* timeline_event) const { |
395 stream_->PrintValue(timeline_event); | 415 stream_->PrintValue(timeline_event); |
396 } | 416 } |
397 void AddValue(const TimelineEventBlock* timeline_event_block) const { | 417 void AddValue(const TimelineEventBlock* timeline_event_block) const { |
398 stream_->PrintValue(timeline_event_block); | 418 stream_->PrintValue(timeline_event_block); |
399 } | 419 } |
400 void AddValueVM(bool ref = true) const { stream_->PrintValueVM(ref); } | 420 void AddValueVM(bool ref = true) const { stream_->PrintValueVM(ref); } |
401 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 421 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
402 | 422 |
403 private: | 423 private: |
404 JSONStream* stream_; | 424 JSONStream* stream_; |
405 | 425 |
406 friend class JSONObject; | 426 friend class JSONObject; |
407 | 427 |
408 DISALLOW_ALLOCATION(); | 428 DISALLOW_ALLOCATION(); |
409 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 429 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
410 }; | 430 }; |
411 | 431 |
412 } // namespace dart | 432 } // namespace dart |
413 | 433 |
414 #endif // RUNTIME_VM_JSON_STREAM_H_ | 434 #endif // RUNTIME_VM_JSON_STREAM_H_ |
OLD | NEW |