| 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" |
| 11 #include "vm/metrics.h" | 11 #include "vm/metrics.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/service.h" |
| 13 #include "vm/service_event.h" | 14 #include "vm/service_event.h" |
| 14 #include "vm/service.h" | |
| 15 #include "vm/timeline.h" | 15 #include "vm/timeline.h" |
| 16 #include "vm/unicode.h" | 16 #include "vm/unicode.h" |
| 17 | 17 |
| 18 | 18 |
| 19 namespace dart { | 19 namespace dart { |
| 20 | 20 |
| 21 DECLARE_FLAG(bool, trace_service); | 21 DECLARE_FLAG(bool, trace_service); |
| 22 | 22 |
| 23 JSONStream::JSONStream(intptr_t buf_size) | 23 JSONStream::JSONStream(intptr_t buf_size) |
| 24 : open_objects_(0), | 24 : open_objects_(0), |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 isolate->PrintJSON(this, ref); | 436 isolate->PrintJSON(this, ref); |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 void JSONStream::PrintValue(TimelineEvent* timeline_event) { | 440 void JSONStream::PrintValue(TimelineEvent* timeline_event) { |
| 441 PrintCommaIfNeeded(); | 441 PrintCommaIfNeeded(); |
| 442 timeline_event->PrintJSON(this); | 442 timeline_event->PrintJSON(this); |
| 443 } | 443 } |
| 444 | 444 |
| 445 | 445 |
| 446 void JSONStream::PrintValueVM(bool ref) { |
| 447 PrintCommaIfNeeded(); |
| 448 Service::PrintJSONForVM(this, ref); |
| 449 } |
| 450 |
| 451 |
| 446 void JSONStream::PrintServiceId(const Object& o) { | 452 void JSONStream::PrintServiceId(const Object& o) { |
| 447 ASSERT(id_zone_ != NULL); | 453 ASSERT(id_zone_ != NULL); |
| 448 PrintProperty("id", id_zone_->GetServiceId(o)); | 454 PrintProperty("id", id_zone_->GetServiceId(o)); |
| 449 } | 455 } |
| 450 | 456 |
| 451 | 457 |
| 452 void JSONStream::PrintPropertyBool(const char* name, bool b) { | 458 void JSONStream::PrintPropertyBool(const char* name, bool b) { |
| 453 PrintPropertyName(name); | 459 PrintPropertyName(name); |
| 454 PrintValueBool(b); | 460 PrintValueBool(b); |
| 455 } | 461 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 num_params_ = num_params; | 593 num_params_ = num_params; |
| 588 } | 594 } |
| 589 | 595 |
| 590 | 596 |
| 591 void JSONStream::PrintProperty(const char* name, const Object& o, bool ref) { | 597 void JSONStream::PrintProperty(const char* name, const Object& o, bool ref) { |
| 592 PrintPropertyName(name); | 598 PrintPropertyName(name); |
| 593 PrintValue(o, ref); | 599 PrintValue(o, ref); |
| 594 } | 600 } |
| 595 | 601 |
| 596 | 602 |
| 603 void JSONStream::PrintPropertyVM(const char* name, bool ref) { |
| 604 PrintPropertyName(name); |
| 605 PrintValueVM(ref); |
| 606 } |
| 607 |
| 608 |
| 597 void JSONStream::PrintPropertyName(const char* name) { | 609 void JSONStream::PrintPropertyName(const char* name) { |
| 598 ASSERT(name != NULL); | 610 ASSERT(name != NULL); |
| 599 PrintCommaIfNeeded(); | 611 PrintCommaIfNeeded(); |
| 600 buffer_.AddChar('"'); | 612 buffer_.AddChar('"'); |
| 601 AddEscapedUTF8String(name); | 613 AddEscapedUTF8String(name); |
| 602 buffer_.AddChar('"'); | 614 buffer_.AddChar('"'); |
| 603 buffer_.AddChar(':'); | 615 buffer_.AddChar(':'); |
| 604 } | 616 } |
| 605 | 617 |
| 606 | 618 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 806 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 795 va_end(args); | 807 va_end(args); |
| 796 ASSERT(len == len2); | 808 ASSERT(len == len2); |
| 797 stream_->buffer_.AddChar('"'); | 809 stream_->buffer_.AddChar('"'); |
| 798 stream_->AddEscapedUTF8String(p); | 810 stream_->AddEscapedUTF8String(p); |
| 799 stream_->buffer_.AddChar('"'); | 811 stream_->buffer_.AddChar('"'); |
| 800 free(p); | 812 free(p); |
| 801 } | 813 } |
| 802 | 814 |
| 803 } // namespace dart | 815 } // namespace dart |
| OLD | NEW |