| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 const Script& script = Script::Handle(lib.LookupScript(script_url)); | 561 const Script& script = Script::Handle(lib.LookupScript(script_url)); |
| 562 if (script.IsNull()) { | 562 if (script.IsNull()) { |
| 563 return Api::NewError("%s: script '%s' not found in library '%s'", | 563 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 564 CURRENT_FUNC, script_url.ToCString(), | 564 CURRENT_FUNC, script_url.ToCString(), |
| 565 String::Handle(lib.url()).ToCString()); | 565 String::Handle(lib.url()).ToCString()); |
| 566 } | 566 } |
| 567 return Api::NewHandle(isolate, script.Source()); | 567 return Api::NewHandle(isolate, script.Source()); |
| 568 } | 568 } |
| 569 | 569 |
| 570 | 570 |
| 571 DART_EXPORT Dart_Handle Dart_GetScriptSource( | |
| 572 Dart_Handle library_url_in, | |
| 573 Dart_Handle script_url_in) { | |
| 574 Isolate* isolate = Isolate::Current(); | |
| 575 DARTSCOPE(isolate); | |
| 576 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | |
| 577 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | |
| 578 | |
| 579 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | |
| 580 if (library.IsNull()) { | |
| 581 return Api::NewError("%s: library '%s' not found", | |
| 582 CURRENT_FUNC, library_url.ToCString()); | |
| 583 } | |
| 584 | |
| 585 const Script& script = Script::Handle(library.LookupScript(script_url)); | |
| 586 if (script.IsNull()) { | |
| 587 return Api::NewError("%s: script '%s' not found in library '%s'", | |
| 588 CURRENT_FUNC, script_url.ToCString(), | |
| 589 library_url.ToCString()); | |
| 590 } | |
| 591 | |
| 592 return Api::NewHandle(isolate, script.Source()); | |
| 593 } | |
| 594 | |
| 595 | |
| 596 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { | 571 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { |
| 597 Isolate* isolate = Isolate::Current(); | 572 Isolate* isolate = Isolate::Current(); |
| 598 DARTSCOPE(isolate); | 573 DARTSCOPE(isolate); |
| 599 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 574 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 600 | 575 |
| 601 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 576 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); |
| 602 if (library.IsNull()) { | 577 if (library.IsNull()) { |
| 603 return Api::NewError("%s: library '%s' not found", | 578 return Api::NewError("%s: library '%s' not found", |
| 604 CURRENT_FUNC, library_url.ToCString()); | 579 CURRENT_FUNC, library_url.ToCString()); |
| 605 } | 580 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 728 |
| 754 | 729 |
| 755 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 730 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
| 756 if (strncmp(request, "/isolate/", 9) == 0) { | 731 if (strncmp(request, "/isolate/", 9) == 0) { |
| 757 return Isolate::GetStatus(request); | 732 return Isolate::GetStatus(request); |
| 758 } | 733 } |
| 759 return NULL; | 734 return NULL; |
| 760 } | 735 } |
| 761 | 736 |
| 762 } // namespace dart | 737 } // namespace dart |
| OLD | NEW |