| 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_GenerateScriptSource(Dart_Handle library_url_in, |
| 572 Dart_Handle script_url_in) { |
| 573 Isolate* isolate = Isolate::Current(); |
| 574 DARTSCOPE(isolate); |
| 575 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 576 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 577 |
| 578 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); |
| 579 if (library.IsNull()) { |
| 580 return Api::NewError("%s: library '%s' not found", |
| 581 CURRENT_FUNC, library_url.ToCString()); |
| 582 } |
| 583 |
| 584 const Script& script = Script::Handle(library.LookupScript(script_url)); |
| 585 if (script.IsNull()) { |
| 586 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 587 CURRENT_FUNC, script_url.ToCString(), |
| 588 library_url.ToCString()); |
| 589 } |
| 590 |
| 591 return Api::NewHandle(isolate, script.GenerateSource()); |
| 592 } |
| 593 |
| 594 |
| 571 DART_EXPORT Dart_Handle Dart_GetScriptSource( | 595 DART_EXPORT Dart_Handle Dart_GetScriptSource( |
| 572 Dart_Handle library_url_in, | 596 Dart_Handle library_url_in, |
| 573 Dart_Handle script_url_in) { | 597 Dart_Handle script_url_in) { |
| 574 Isolate* isolate = Isolate::Current(); | 598 Isolate* isolate = Isolate::Current(); |
| 575 DARTSCOPE(isolate); | 599 DARTSCOPE(isolate); |
| 576 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 600 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 577 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 601 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 578 | 602 |
| 579 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 603 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); |
| 580 if (library.IsNull()) { | 604 if (library.IsNull()) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 777 |
| 754 | 778 |
| 755 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 779 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
| 756 if (strncmp(request, "/isolate/", 9) == 0) { | 780 if (strncmp(request, "/isolate/", 9) == 0) { |
| 757 return Isolate::GetStatus(request); | 781 return Isolate::GetStatus(request); |
| 758 } | 782 } |
| 759 return NULL; | 783 return NULL; |
| 760 } | 784 } |
| 761 | 785 |
| 762 } // namespace dart | 786 } // namespace dart |
| OLD | NEW |