OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 "vm/debugger.h" | 5 #include "vm/debugger.h" |
6 #include "vm/disassembler.h" | 6 #include "vm/disassembler.h" |
7 #include "vm/object.h" | 7 #include "vm/object.h" |
8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { | 441 void Script::PrintJSONImpl(JSONStream* stream, bool ref) const { |
442 JSONObject jsobj(stream); | 442 JSONObject jsobj(stream); |
443 AddCommonObjectProperties(&jsobj, "Script", ref); | 443 AddCommonObjectProperties(&jsobj, "Script", ref); |
444 const String& uri = String::Handle(url()); | 444 const String& uri = String::Handle(url()); |
445 ASSERT(!uri.IsNull()); | 445 ASSERT(!uri.IsNull()); |
446 const char* encoded_uri = String::EncodeIRI(uri); | 446 const char* encoded_uri = String::EncodeIRI(uri); |
447 const Library& lib = Library::Handle(FindLibrary()); | 447 const Library& lib = Library::Handle(FindLibrary()); |
448 if (lib.IsNull()) { | 448 if (lib.IsNull()) { |
449 jsobj.AddServiceId(*this); | 449 jsobj.AddServiceId(*this); |
450 } else { | 450 } else { |
451 jsobj.AddFixedServiceId("libraries/%" Pd "/scripts/%s/%" Px64 "", | 451 const String& lib_id = String::Handle(lib.private_key()); |
452 lib.index(), encoded_uri, load_timestamp()); | 452 jsobj.AddFixedServiceId("libraries/%s/scripts/%s/%" Px64 "", |
| 453 lib_id.ToCString(), encoded_uri, load_timestamp()); |
453 } | 454 } |
454 jsobj.AddPropertyStr("uri", uri); | 455 jsobj.AddPropertyStr("uri", uri); |
455 jsobj.AddProperty("_kind", GetKindAsCString()); | 456 jsobj.AddProperty("_kind", GetKindAsCString()); |
456 if (ref) { | 457 if (ref) { |
457 return; | 458 return; |
458 } | 459 } |
459 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); | 460 jsobj.AddPropertyTimeMillis("_loadTime", load_timestamp()); |
460 if (!lib.IsNull()) { | 461 if (!lib.IsNull()) { |
461 jsobj.AddProperty("library", lib); | 462 jsobj.AddProperty("library", lib); |
462 } | 463 } |
(...skipping 29 matching lines...) Expand all Loading... |
492 } | 493 } |
493 const Smi& smi = Smi::Cast(value); | 494 const Smi& smi = Smi::Cast(value); |
494 lineInfo.AddValue(smi.Value()); | 495 lineInfo.AddValue(smi.Value()); |
495 } | 496 } |
496 } | 497 } |
497 } | 498 } |
498 } | 499 } |
499 | 500 |
500 | 501 |
501 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { | 502 void Library::PrintJSONImpl(JSONStream* stream, bool ref) const { |
502 intptr_t id = index(); | 503 const String& id = String::Handle(private_key()); |
503 ASSERT(id >= 0); | |
504 JSONObject jsobj(stream); | 504 JSONObject jsobj(stream); |
505 AddCommonObjectProperties(&jsobj, "Library", ref); | 505 AddCommonObjectProperties(&jsobj, "Library", ref); |
506 jsobj.AddFixedServiceId("libraries/%" Pd "", id); | 506 jsobj.AddFixedServiceId("libraries/%s", id.ToCString()); |
507 const String& vm_name = String::Handle(name()); | 507 const String& vm_name = String::Handle(name()); |
508 const String& scrubbed_name = String::Handle(String::ScrubName(vm_name)); | 508 const String& scrubbed_name = String::Handle(String::ScrubName(vm_name)); |
509 AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString()); | 509 AddNameProperties(&jsobj, scrubbed_name.ToCString(), vm_name.ToCString()); |
510 const String& library_url = String::Handle(url()); | 510 const String& library_url = String::Handle(url()); |
511 jsobj.AddPropertyStr("uri", library_url); | 511 jsobj.AddPropertyStr("uri", library_url); |
512 if (ref) { | 512 if (ref) { |
513 return; | 513 return; |
514 } | 514 } |
515 jsobj.AddProperty("debuggable", IsDebuggable()); | 515 jsobj.AddProperty("debuggable", IsDebuggable()); |
516 { | 516 { |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 jsobj.AddProperty("mirrorReferent", referent_handle); | 1550 jsobj.AddProperty("mirrorReferent", referent_handle); |
1551 } | 1551 } |
1552 | 1552 |
1553 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 1553 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
1554 Instance::PrintJSONImpl(stream, ref); | 1554 Instance::PrintJSONImpl(stream, ref); |
1555 } | 1555 } |
1556 | 1556 |
1557 #endif | 1557 #endif |
1558 | 1558 |
1559 } // namespace dart | 1559 } // namespace dart |
OLD | NEW |