| 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 return Api::NewError("%s: %d is not a valid library id", | 498 return Api::NewError("%s: %d is not a valid library id", |
| 499 CURRENT_FUNC, library_id); | 499 CURRENT_FUNC, library_id); |
| 500 } | 500 } |
| 501 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 501 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 502 const Script& script = Script::Handle(lib.LookupScript(script_url)); | 502 const Script& script = Script::Handle(lib.LookupScript(script_url)); |
| 503 if (script.IsNull()) { | 503 if (script.IsNull()) { |
| 504 return Api::NewError("%s: script '%s' not found in library '%s'", | 504 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 505 CURRENT_FUNC, script_url.ToCString(), | 505 CURRENT_FUNC, script_url.ToCString(), |
| 506 String::Handle(lib.url()).ToCString()); | 506 String::Handle(lib.url()).ToCString()); |
| 507 } | 507 } |
| 508 return Api::NewHandle(isolate, script.source()); | 508 return Api::NewHandle(isolate, script.Source()); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 DART_EXPORT Dart_Handle Dart_GetScriptSource( | 512 DART_EXPORT Dart_Handle Dart_GetScriptSource( |
| 513 Dart_Handle library_url_in, | 513 Dart_Handle library_url_in, |
| 514 Dart_Handle script_url_in) { | 514 Dart_Handle script_url_in) { |
| 515 Isolate* isolate = Isolate::Current(); | 515 Isolate* isolate = Isolate::Current(); |
| 516 DARTSCOPE(isolate); | 516 DARTSCOPE(isolate); |
| 517 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 517 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 518 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 518 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 519 | 519 |
| 520 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 520 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); |
| 521 if (library.IsNull()) { | 521 if (library.IsNull()) { |
| 522 return Api::NewError("%s: library '%s' not found", | 522 return Api::NewError("%s: library '%s' not found", |
| 523 CURRENT_FUNC, library_url.ToCString()); | 523 CURRENT_FUNC, library_url.ToCString()); |
| 524 } | 524 } |
| 525 | 525 |
| 526 const Script& script = Script::Handle(library.LookupScript(script_url)); | 526 const Script& script = Script::Handle(library.LookupScript(script_url)); |
| 527 if (script.IsNull()) { | 527 if (script.IsNull()) { |
| 528 return Api::NewError("%s: script '%s' not found in library '%s'", | 528 return Api::NewError("%s: script '%s' not found in library '%s'", |
| 529 CURRENT_FUNC, script_url.ToCString(), | 529 CURRENT_FUNC, script_url.ToCString(), |
| 530 library_url.ToCString()); | 530 library_url.ToCString()); |
| 531 } | 531 } |
| 532 | 532 |
| 533 return Api::NewHandle(isolate, script.source()); | 533 return Api::NewHandle(isolate, script.Source()); |
| 534 } | 534 } |
| 535 | 535 |
| 536 | 536 |
| 537 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { | 537 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { |
| 538 Isolate* isolate = Isolate::Current(); | 538 Isolate* isolate = Isolate::Current(); |
| 539 DARTSCOPE(isolate); | 539 DARTSCOPE(isolate); |
| 540 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 540 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
| 541 | 541 |
| 542 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 542 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); |
| 543 if (library.IsNull()) { | 543 if (library.IsNull()) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 for (int i = 0; i < num_libs; i++) { | 650 for (int i = 0; i < num_libs; i++) { |
| 651 lib ^= libs.At(i); | 651 lib ^= libs.At(i); |
| 652 ASSERT(!lib.IsNull()); | 652 ASSERT(!lib.IsNull()); |
| 653 lib_url = lib.url(); | 653 lib_url = lib.url(); |
| 654 library_url_list.SetAt(i, lib_url); | 654 library_url_list.SetAt(i, lib_url); |
| 655 } | 655 } |
| 656 return Api::NewHandle(isolate, library_url_list.raw()); | 656 return Api::NewHandle(isolate, library_url_list.raw()); |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace dart | 659 } // namespace dart |
| OLD | NEW |