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 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
10 #include "vm/message.h" | 10 #include "vm/message.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (*offset > length) { | 256 if (*offset > length) { |
257 *offset = length; | 257 *offset = length; |
258 } | 258 } |
259 intptr_t remaining = length - *offset; | 259 intptr_t remaining = length - *offset; |
260 *count = count_; | 260 *count = count_; |
261 if (*count < 0 || *count > remaining) { | 261 if (*count < 0 || *count > remaining) { |
262 *count = remaining; | 262 *count = remaining; |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
| 266 |
| 267 void JSONStream::AppendSerializedObject(const char* serialized_object) { |
| 268 PrintCommaIfNeeded(); |
| 269 buffer_.AddString(serialized_object); |
| 270 } |
| 271 |
| 272 |
266 void JSONStream::Clear() { | 273 void JSONStream::Clear() { |
267 buffer_.Clear(); | 274 buffer_.Clear(); |
268 open_objects_ = 0; | 275 open_objects_ = 0; |
269 } | 276 } |
270 | 277 |
271 | 278 |
272 void JSONStream::OpenObject(const char* property_name) { | 279 void JSONStream::OpenObject(const char* property_name) { |
273 PrintCommaIfNeeded(); | 280 PrintCommaIfNeeded(); |
274 open_objects_++; | 281 open_objects_++; |
275 if (property_name != NULL) { | 282 if (property_name != NULL) { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 831 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
825 va_end(args); | 832 va_end(args); |
826 ASSERT(len == len2); | 833 ASSERT(len == len2); |
827 stream_->buffer_.AddChar('"'); | 834 stream_->buffer_.AddChar('"'); |
828 stream_->AddEscapedUTF8String(p); | 835 stream_->AddEscapedUTF8String(p); |
829 stream_->buffer_.AddChar('"'); | 836 stream_->buffer_.AddChar('"'); |
830 free(p); | 837 free(p); |
831 } | 838 } |
832 | 839 |
833 } // namespace dart | 840 } // namespace dart |
OLD | NEW |