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/json.h" | 9 #include "platform/json.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 void OpenObject(const char* property_name = NULL); | 111 void OpenObject(const char* property_name = NULL); |
112 void CloseObject(); | 112 void CloseObject(); |
113 | 113 |
114 void OpenArray(const char* property_name = NULL); | 114 void OpenArray(const char* property_name = NULL); |
115 void CloseArray(); | 115 void CloseArray(); |
116 | 116 |
117 void PrintValueBool(bool b); | 117 void PrintValueBool(bool b); |
118 void PrintValue(intptr_t i); | 118 void PrintValue(intptr_t i); |
119 void PrintValue64(int64_t i); | 119 void PrintValue64(int64_t i); |
| 120 void PrintValueTimeMillis(int64_t millis); |
120 void PrintValue(double d); | 121 void PrintValue(double d); |
121 void PrintValueBase64(const uint8_t* bytes, intptr_t length); | 122 void PrintValueBase64(const uint8_t* bytes, intptr_t length); |
122 void PrintValue(const char* s); | 123 void PrintValue(const char* s); |
123 void PrintValue(const char* s, intptr_t len); | 124 void PrintValue(const char* s, intptr_t len); |
124 void PrintValueNoEscape(const char* s); | 125 void PrintValueNoEscape(const char* s); |
125 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 126 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
126 void PrintValue(const Object& o, bool ref = true); | 127 void PrintValue(const Object& o, bool ref = true); |
127 void PrintValue(Breakpoint* bpt); | 128 void PrintValue(Breakpoint* bpt); |
128 void PrintValue(const ServiceEvent* event); | 129 void PrintValue(const ServiceEvent* event); |
129 void PrintValue(Metric* metric); | 130 void PrintValue(Metric* metric); |
130 void PrintValue(MessageQueue* queue); | 131 void PrintValue(MessageQueue* queue); |
131 void PrintValue(Isolate* isolate, bool ref = true); | 132 void PrintValue(Isolate* isolate, bool ref = true); |
132 bool PrintValueStr(const String& s, intptr_t limit); | 133 bool PrintValueStr(const String& s, intptr_t limit); |
133 void PrintValue(TimelineEvent* timeline_event); | 134 void PrintValue(TimelineEvent* timeline_event); |
134 | 135 |
135 void PrintServiceId(const Object& o); | 136 void PrintServiceId(const Object& o); |
136 void PrintPropertyBool(const char* name, bool b); | 137 void PrintPropertyBool(const char* name, bool b); |
137 void PrintProperty(const char* name, intptr_t i); | 138 void PrintProperty(const char* name, intptr_t i); |
138 void PrintProperty64(const char* name, int64_t i); | 139 void PrintProperty64(const char* name, int64_t i); |
| 140 void PrintPropertyTimeMillis(const char* name, int64_t millis); |
139 void PrintProperty(const char* name, double d); | 141 void PrintProperty(const char* name, double d); |
140 void PrintPropertyBase64(const char* name, | 142 void PrintPropertyBase64(const char* name, |
141 const uint8_t* bytes, | 143 const uint8_t* bytes, |
142 intptr_t length); | 144 intptr_t length); |
143 void PrintProperty(const char* name, const char* s); | 145 void PrintProperty(const char* name, const char* s); |
144 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 146 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
145 void PrintPropertyNoEscape(const char* name, const char* s); | 147 void PrintPropertyNoEscape(const char* name, const char* s); |
146 void PrintfProperty(const char* name, const char* format, ...) | 148 void PrintfProperty(const char* name, const char* format, ...) |
147 PRINTF_ATTRIBUTE(3, 4); | 149 PRINTF_ATTRIBUTE(3, 4); |
148 void PrintProperty(const char* name, const Object& o, bool ref = true); | 150 void PrintProperty(const char* name, const Object& o, bool ref = true); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 209 |
208 void AddProperty(const char* name, bool b) const { | 210 void AddProperty(const char* name, bool b) const { |
209 stream_->PrintPropertyBool(name, b); | 211 stream_->PrintPropertyBool(name, b); |
210 } | 212 } |
211 void AddProperty(const char* name, intptr_t i) const { | 213 void AddProperty(const char* name, intptr_t i) const { |
212 stream_->PrintProperty(name, i); | 214 stream_->PrintProperty(name, i); |
213 } | 215 } |
214 void AddProperty64(const char* name, int64_t i) const { | 216 void AddProperty64(const char* name, int64_t i) const { |
215 stream_->PrintProperty64(name, i); | 217 stream_->PrintProperty64(name, i); |
216 } | 218 } |
| 219 void AddPropertyTimeMillis(const char* name, int64_t millis) const { |
| 220 stream_->PrintPropertyTimeMillis(name, millis); |
| 221 } |
217 void AddProperty(const char* name, double d) const { | 222 void AddProperty(const char* name, double d) const { |
218 stream_->PrintProperty(name, d); | 223 stream_->PrintProperty(name, d); |
219 } | 224 } |
220 void AddPropertyBase64(const char* name, | 225 void AddPropertyBase64(const char* name, |
221 const uint8_t* bytes, | 226 const uint8_t* bytes, |
222 intptr_t length) const { | 227 intptr_t length) const { |
223 stream_->PrintPropertyBase64(name, bytes, length); | 228 stream_->PrintPropertyBase64(name, bytes, length); |
224 } | 229 } |
225 void AddProperty(const char* name, const char* s) const { | 230 void AddProperty(const char* name, const char* s) const { |
226 stream_->PrintProperty(name, s); | 231 stream_->PrintProperty(name, s); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { | 283 explicit JSONArray(const JSONArray* arr) : stream_(arr->stream_) { |
279 stream_->OpenArray(); | 284 stream_->OpenArray(); |
280 } | 285 } |
281 ~JSONArray() { | 286 ~JSONArray() { |
282 stream_->CloseArray(); | 287 stream_->CloseArray(); |
283 } | 288 } |
284 | 289 |
285 void AddValue(bool b) const { stream_->PrintValueBool(b); } | 290 void AddValue(bool b) const { stream_->PrintValueBool(b); } |
286 void AddValue(intptr_t i) const { stream_->PrintValue(i); } | 291 void AddValue(intptr_t i) const { stream_->PrintValue(i); } |
287 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } | 292 void AddValue64(int64_t i) const { stream_->PrintValue64(i); } |
| 293 void AddValueTimeMillis(int64_t millis) const { |
| 294 stream_->PrintValueTimeMillis(millis); |
| 295 } |
288 void AddValue(double d) const { stream_->PrintValue(d); } | 296 void AddValue(double d) const { stream_->PrintValue(d); } |
289 void AddValue(const char* s) const { stream_->PrintValue(s); } | 297 void AddValue(const char* s) const { stream_->PrintValue(s); } |
290 void AddValue(const Object& obj, bool ref = true) const { | 298 void AddValue(const Object& obj, bool ref = true) const { |
291 stream_->PrintValue(obj, ref); | 299 stream_->PrintValue(obj, ref); |
292 } | 300 } |
293 void AddValue(Isolate* isolate, bool ref = true) const { | 301 void AddValue(Isolate* isolate, bool ref = true) const { |
294 stream_->PrintValue(isolate, ref); | 302 stream_->PrintValue(isolate, ref); |
295 } | 303 } |
296 void AddValue(Breakpoint* bpt) const { | 304 void AddValue(Breakpoint* bpt) const { |
297 stream_->PrintValue(bpt); | 305 stream_->PrintValue(bpt); |
(...skipping 17 matching lines...) Expand all Loading... |
315 | 323 |
316 friend class JSONObject; | 324 friend class JSONObject; |
317 | 325 |
318 DISALLOW_ALLOCATION(); | 326 DISALLOW_ALLOCATION(); |
319 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 327 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
320 }; | 328 }; |
321 | 329 |
322 } // namespace dart | 330 } // namespace dart |
323 | 331 |
324 #endif // VM_JSON_STREAM_H_ | 332 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |