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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 void PrintValue(const char* s); | 152 void PrintValue(const char* s); |
153 void PrintValue(const char* s, intptr_t len); | 153 void PrintValue(const char* s, intptr_t len); |
154 void PrintValueNoEscape(const char* s); | 154 void PrintValueNoEscape(const char* s); |
155 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 155 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
156 void PrintValue(const Object& o, bool ref = true); | 156 void PrintValue(const Object& o, bool ref = true); |
157 void PrintValue(Breakpoint* bpt); | 157 void PrintValue(Breakpoint* bpt); |
158 void PrintValue(const ServiceEvent* event); | 158 void PrintValue(const ServiceEvent* event); |
159 void PrintValue(Metric* metric); | 159 void PrintValue(Metric* metric); |
160 void PrintValue(MessageQueue* queue); | 160 void PrintValue(MessageQueue* queue); |
161 void PrintValue(Isolate* isolate, bool ref = true); | 161 void PrintValue(Isolate* isolate, bool ref = true); |
162 bool PrintValueStr(const String& s, intptr_t limit); | 162 bool PrintValueStr(const String& s, intptr_t offset, intptr_t count); |
163 void PrintValue(TimelineEvent* timeline_event); | 163 void PrintValue(TimelineEvent* timeline_event); |
164 void PrintValueVM(bool ref = true); | 164 void PrintValueVM(bool ref = true); |
165 | 165 |
166 void PrintServiceId(const Object& o); | 166 void PrintServiceId(const Object& o); |
167 void PrintPropertyBool(const char* name, bool b); | 167 void PrintPropertyBool(const char* name, bool b); |
168 void PrintProperty(const char* name, intptr_t i); | 168 void PrintProperty(const char* name, intptr_t i); |
169 void PrintProperty64(const char* name, int64_t i); | 169 void PrintProperty64(const char* name, int64_t i); |
170 void PrintPropertyTimeMillis(const char* name, int64_t millis); | 170 void PrintPropertyTimeMillis(const char* name, int64_t millis); |
171 void PrintPropertyTimeMicros(const char* name, int64_t micros); | 171 void PrintPropertyTimeMicros(const char* name, int64_t micros); |
172 void PrintProperty(const char* name, double d); | 172 void PrintProperty(const char* name, double d); |
173 void PrintPropertyBase64(const char* name, | 173 void PrintPropertyBase64(const char* name, |
174 const uint8_t* bytes, | 174 const uint8_t* bytes, |
175 intptr_t length); | 175 intptr_t length); |
176 void PrintProperty(const char* name, const char* s); | 176 void PrintProperty(const char* name, const char* s); |
177 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 177 bool PrintPropertyStr(const char* name, const String& s, |
| 178 intptr_t offset, intptr_t count); |
178 void PrintPropertyNoEscape(const char* name, const char* s); | 179 void PrintPropertyNoEscape(const char* name, const char* s); |
179 void PrintfProperty(const char* name, const char* format, ...) | 180 void PrintfProperty(const char* name, const char* format, ...) |
180 PRINTF_ATTRIBUTE(3, 4); | 181 PRINTF_ATTRIBUTE(3, 4); |
181 void PrintProperty(const char* name, const Object& o, bool ref = true); | 182 void PrintProperty(const char* name, const Object& o, bool ref = true); |
182 | 183 |
183 void PrintProperty(const char* name, const ServiceEvent* event); | 184 void PrintProperty(const char* name, const ServiceEvent* event); |
184 void PrintProperty(const char* name, Breakpoint* bpt); | 185 void PrintProperty(const char* name, Breakpoint* bpt); |
185 void PrintProperty(const char* name, Metric* metric); | 186 void PrintProperty(const char* name, Metric* metric); |
186 void PrintProperty(const char* name, MessageQueue* queue); | 187 void PrintProperty(const char* name, MessageQueue* queue); |
187 void PrintProperty(const char* name, Isolate* isolate); | 188 void PrintProperty(const char* name, Isolate* isolate); |
188 void PrintProperty(const char* name, TimelineEvent* timeline_event); | 189 void PrintProperty(const char* name, TimelineEvent* timeline_event); |
189 void PrintPropertyVM(const char* name, bool ref = true); | 190 void PrintPropertyVM(const char* name, bool ref = true); |
190 void PrintPropertyName(const char* name); | 191 void PrintPropertyName(const char* name); |
191 void PrintCommaIfNeeded(); | 192 void PrintCommaIfNeeded(); |
192 bool NeedComma(); | 193 bool NeedComma(); |
193 | 194 |
194 bool AddDartString(const String& s, intptr_t limit); | 195 bool AddDartString(const String& s, intptr_t offset, intptr_t count); |
195 void AddEscapedUTF8String(const char* s); | 196 void AddEscapedUTF8String(const char* s); |
196 void AddEscapedUTF8String(const char* s, intptr_t len); | 197 void AddEscapedUTF8String(const char* s, intptr_t len); |
197 | 198 |
198 intptr_t nesting_level() const { return open_objects_; } | 199 intptr_t nesting_level() const { return open_objects_; } |
199 | 200 |
200 // Debug only fatal assertion. | 201 // Debug only fatal assertion. |
201 static void EnsureIntegerIsRepresentableInJavaScript(int64_t i); | 202 static void EnsureIntegerIsRepresentableInJavaScript(int64_t i); |
202 | 203 |
203 intptr_t open_objects_; | 204 intptr_t open_objects_; |
204 TextBuffer buffer_; | 205 TextBuffer buffer_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 void AddPropertyBase64(const char* name, | 270 void AddPropertyBase64(const char* name, |
270 const uint8_t* bytes, | 271 const uint8_t* bytes, |
271 intptr_t length) const { | 272 intptr_t length) const { |
272 stream_->PrintPropertyBase64(name, bytes, length); | 273 stream_->PrintPropertyBase64(name, bytes, length); |
273 } | 274 } |
274 void AddProperty(const char* name, const char* s) const { | 275 void AddProperty(const char* name, const char* s) const { |
275 stream_->PrintProperty(name, s); | 276 stream_->PrintProperty(name, s); |
276 } | 277 } |
277 bool AddPropertyStr(const char* name, | 278 bool AddPropertyStr(const char* name, |
278 const String& s, | 279 const String& s, |
279 intptr_t limit = -1) const { | 280 intptr_t offset = 0, |
280 return stream_->PrintPropertyStr(name, s, limit); | 281 intptr_t count = -1) const { |
| 282 return stream_->PrintPropertyStr(name, s, offset, count); |
281 } | 283 } |
282 void AddPropertyNoEscape(const char* name, const char* s) const { | 284 void AddPropertyNoEscape(const char* name, const char* s) const { |
283 stream_->PrintPropertyNoEscape(name, s); | 285 stream_->PrintPropertyNoEscape(name, s); |
284 } | 286 } |
285 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 287 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
286 stream_->PrintProperty(name, obj, ref); | 288 stream_->PrintProperty(name, obj, ref); |
287 } | 289 } |
288 void AddProperty(const char* name, const ServiceEvent* event) const { | 290 void AddProperty(const char* name, const ServiceEvent* event) const { |
289 stream_->PrintProperty(name, event); | 291 stream_->PrintProperty(name, event); |
290 } | 292 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 379 |
378 friend class JSONObject; | 380 friend class JSONObject; |
379 | 381 |
380 DISALLOW_ALLOCATION(); | 382 DISALLOW_ALLOCATION(); |
381 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 383 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
382 }; | 384 }; |
383 | 385 |
384 } // namespace dart | 386 } // namespace dart |
385 | 387 |
386 #endif // VM_JSON_STREAM_H_ | 388 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |