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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Instance; | 22 class Instance; |
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 Zone; | 33 class Zone; |
33 | 34 |
34 | 35 |
35 // Keep this enum in sync with: | 36 // Keep this enum in sync with: |
36 // | 37 // |
37 // - runtime/vm/service/vmservice.dart | 38 // - runtime/vm/service/vmservice.dart |
38 // - runtime/observatory/lib/src/service/object.dart | 39 // - runtime/observatory/lib/src/service/object.dart |
39 // | 40 // |
40 enum JSONRpcErrorCode { | 41 enum JSONRpcErrorCode { |
41 kParseError = -32700, | 42 kParseError = -32700, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void PrintValueNoEscape(const char* s); | 156 void PrintValueNoEscape(const char* s); |
156 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 157 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
157 void PrintValue(const Object& o, bool ref = true); | 158 void PrintValue(const Object& o, bool ref = true); |
158 void PrintValue(Breakpoint* bpt); | 159 void PrintValue(Breakpoint* bpt); |
159 void PrintValue(TokenPosition tp); | 160 void PrintValue(TokenPosition tp); |
160 void PrintValue(const ServiceEvent* event); | 161 void PrintValue(const ServiceEvent* event); |
161 void PrintValue(Metric* metric); | 162 void PrintValue(Metric* metric); |
162 void PrintValue(MessageQueue* queue); | 163 void PrintValue(MessageQueue* queue); |
163 void PrintValue(Isolate* isolate, bool ref = true); | 164 void PrintValue(Isolate* isolate, bool ref = true); |
164 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); | 165 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); |
165 void PrintValue(TimelineEvent* timeline_event); | 166 void PrintValue(const TimelineEvent* timeline_event); |
| 167 void PrintValue(const TimelineEventBlock* timeline_event_block); |
166 void PrintValueVM(bool ref = true); | 168 void PrintValueVM(bool ref = true); |
167 | 169 |
168 void PrintServiceId(const Object& o); | 170 void PrintServiceId(const Object& o); |
169 void PrintPropertyBool(const char* name, bool b); | 171 void PrintPropertyBool(const char* name, bool b); |
170 void PrintProperty(const char* name, intptr_t i); | 172 void PrintProperty(const char* name, intptr_t i); |
171 void PrintProperty64(const char* name, int64_t i); | 173 void PrintProperty64(const char* name, int64_t i); |
172 void PrintPropertyTimeMillis(const char* name, int64_t millis); | 174 void PrintPropertyTimeMillis(const char* name, int64_t millis); |
173 void PrintPropertyTimeMicros(const char* name, int64_t micros); | 175 void PrintPropertyTimeMicros(const char* name, int64_t micros); |
174 void PrintProperty(const char* name, double d); | 176 void PrintProperty(const char* name, double d); |
175 void PrintPropertyBase64(const char* name, | 177 void PrintPropertyBase64(const char* name, |
176 const uint8_t* bytes, | 178 const uint8_t* bytes, |
177 intptr_t length); | 179 intptr_t length); |
178 void PrintProperty(const char* name, const char* s); | 180 void PrintProperty(const char* name, const char* s); |
179 bool PrintPropertyStr(const char* name, const String& s, | 181 bool PrintPropertyStr(const char* name, const String& s, |
180 intptr_t offset, intptr_t count); | 182 intptr_t offset, intptr_t count); |
181 void PrintPropertyNoEscape(const char* name, const char* s); | 183 void PrintPropertyNoEscape(const char* name, const char* s); |
182 void PrintfProperty(const char* name, const char* format, ...) | 184 void PrintfProperty(const char* name, const char* format, ...) |
183 PRINTF_ATTRIBUTE(3, 4); | 185 PRINTF_ATTRIBUTE(3, 4); |
184 void PrintProperty(const char* name, const Object& o, bool ref = true); | 186 void PrintProperty(const char* name, const Object& o, bool ref = true); |
185 | 187 |
186 void PrintProperty(const char* name, const ServiceEvent* event); | 188 void PrintProperty(const char* name, const ServiceEvent* event); |
187 void PrintProperty(const char* name, Breakpoint* bpt); | 189 void PrintProperty(const char* name, Breakpoint* bpt); |
188 void PrintProperty(const char* name, TokenPosition tp); | 190 void PrintProperty(const char* name, TokenPosition tp); |
189 void PrintProperty(const char* name, Metric* metric); | 191 void PrintProperty(const char* name, Metric* metric); |
190 void PrintProperty(const char* name, MessageQueue* queue); | 192 void PrintProperty(const char* name, MessageQueue* queue); |
191 void PrintProperty(const char* name, Isolate* isolate); | 193 void PrintProperty(const char* name, Isolate* isolate); |
192 void PrintProperty(const char* name, TimelineEvent* timeline_event); | 194 void PrintProperty(const char* name, const TimelineEvent* timeline_event); |
| 195 void PrintProperty(const char* name, |
| 196 const TimelineEventBlock* timeline_event_block); |
193 void PrintPropertyVM(const char* name, bool ref = true); | 197 void PrintPropertyVM(const char* name, bool ref = true); |
194 void PrintPropertyName(const char* name); | 198 void PrintPropertyName(const char* name); |
195 void PrintCommaIfNeeded(); | 199 void PrintCommaIfNeeded(); |
196 bool NeedComma(); | 200 bool NeedComma(); |
197 | 201 |
198 bool AddDartString(const String& s, intptr_t offset, intptr_t count); | 202 bool AddDartString(const String& s, intptr_t offset, intptr_t count); |
199 void AddEscapedUTF8String(const char* s); | 203 void AddEscapedUTF8String(const char* s); |
200 void AddEscapedUTF8String(const char* s, intptr_t len); | 204 void AddEscapedUTF8String(const char* s, intptr_t len); |
201 | 205 |
202 intptr_t nesting_level() const { return open_objects_; } | 206 intptr_t nesting_level() const { return open_objects_; } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 306 } |
303 void AddProperty(const char* name, Metric* metric) const { | 307 void AddProperty(const char* name, Metric* metric) const { |
304 stream_->PrintProperty(name, metric); | 308 stream_->PrintProperty(name, metric); |
305 } | 309 } |
306 void AddProperty(const char* name, MessageQueue* queue) const { | 310 void AddProperty(const char* name, MessageQueue* queue) const { |
307 stream_->PrintProperty(name, queue); | 311 stream_->PrintProperty(name, queue); |
308 } | 312 } |
309 void AddProperty(const char* name, Isolate* isolate) const { | 313 void AddProperty(const char* name, Isolate* isolate) const { |
310 stream_->PrintProperty(name, isolate); | 314 stream_->PrintProperty(name, isolate); |
311 } | 315 } |
312 void AddProperty(const char* name, TimelineEvent* timeline_event) const { | 316 void AddProperty(const char* name, |
| 317 const TimelineEvent* timeline_event) const { |
313 stream_->PrintProperty(name, timeline_event); | 318 stream_->PrintProperty(name, timeline_event); |
314 } | 319 } |
| 320 void AddProperty(const char* name, |
| 321 const TimelineEventBlock* timeline_event_block) const { |
| 322 stream_->PrintProperty(name, timeline_event_block); |
| 323 } |
315 void AddPropertyVM(const char* name, bool ref = true) const { | 324 void AddPropertyVM(const char* name, bool ref = true) const { |
316 stream_->PrintPropertyVM(name, ref); | 325 stream_->PrintPropertyVM(name, ref); |
317 } | 326 } |
318 void AddPropertyF(const char* name, const char* format, ...) const | 327 void AddPropertyF(const char* name, const char* format, ...) const |
319 PRINTF_ATTRIBUTE(3, 4); | 328 PRINTF_ATTRIBUTE(3, 4); |
320 | 329 |
321 private: | 330 private: |
322 JSONStream* stream_; | 331 JSONStream* stream_; |
323 | 332 |
324 friend class JSONArray; | 333 friend class JSONArray; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 378 } |
370 void AddValue(const ServiceEvent* event) const { | 379 void AddValue(const ServiceEvent* event) const { |
371 stream_->PrintValue(event); | 380 stream_->PrintValue(event); |
372 } | 381 } |
373 void AddValue(Metric* metric) const { | 382 void AddValue(Metric* metric) const { |
374 stream_->PrintValue(metric); | 383 stream_->PrintValue(metric); |
375 } | 384 } |
376 void AddValue(MessageQueue* queue) const { | 385 void AddValue(MessageQueue* queue) const { |
377 stream_->PrintValue(queue); | 386 stream_->PrintValue(queue); |
378 } | 387 } |
379 void AddValue(TimelineEvent* timeline_event) const { | 388 void AddValue(const TimelineEvent* timeline_event) const { |
380 stream_->PrintValue(timeline_event); | 389 stream_->PrintValue(timeline_event); |
381 } | 390 } |
| 391 void AddValue(const TimelineEventBlock* timeline_event_block) const { |
| 392 stream_->PrintValue(timeline_event_block); |
| 393 } |
382 void AddValueVM(bool ref = true) const { | 394 void AddValueVM(bool ref = true) const { |
383 stream_->PrintValueVM(ref); | 395 stream_->PrintValueVM(ref); |
384 } | 396 } |
385 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 397 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
386 | 398 |
387 private: | 399 private: |
388 JSONStream* stream_; | 400 JSONStream* stream_; |
389 | 401 |
390 friend class JSONObject; | 402 friend class JSONObject; |
391 | 403 |
392 DISALLOW_ALLOCATION(); | 404 DISALLOW_ALLOCATION(); |
393 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 405 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
394 }; | 406 }; |
395 | 407 |
396 } // namespace dart | 408 } // namespace dart |
397 | 409 |
398 #endif // VM_JSON_STREAM_H_ | 410 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |