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 | 5 |
6 #include "bin/loader.h" | 6 #include "bin/loader.h" |
7 | 7 |
8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
10 #include "bin/extensions.h" | 10 #include "bin/extensions.h" |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 } | 610 } |
611 | 611 |
612 | 612 |
613 Dart_Handle Loader::ResolveAsFilePath(Dart_Handle url, | 613 Dart_Handle Loader::ResolveAsFilePath(Dart_Handle url, |
614 uint8_t** payload, | 614 uint8_t** payload, |
615 intptr_t* payload_length) { | 615 intptr_t* payload_length) { |
616 return SendAndProcessReply(_Dart_kResolveAsFilePath, url, payload, | 616 return SendAndProcessReply(_Dart_kResolveAsFilePath, url, payload, |
617 payload_length); | 617 payload_length); |
618 } | 618 } |
619 | 619 |
620 | 620 #if defined(DART_PRECOMPILED_RUNTIME) |
621 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, | 621 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, |
622 Dart_Handle library, | 622 Dart_Handle library, |
623 Dart_Handle url) { | 623 Dart_Handle url) { |
| 624 return Dart_Null(); |
| 625 } |
| 626 |
| 627 |
| 628 Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag, |
| 629 Dart_Handle library, |
| 630 Dart_Handle url, |
| 631 const char* library_url_string, |
| 632 const char* url_string) { |
| 633 return Dart_Null(); |
| 634 } |
| 635 #else |
| 636 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, |
| 637 Dart_Handle library, |
| 638 Dart_Handle url) { |
624 if (tag == Dart_kCanonicalizeUrl) { | 639 if (tag == Dart_kCanonicalizeUrl) { |
625 Dart_Handle library_url = Dart_LibraryUrl(library); | 640 Dart_Handle library_url = Dart_LibraryUrl(library); |
626 if (Dart_IsError(library_url)) { | 641 if (Dart_IsError(library_url)) { |
627 return library_url; | 642 return library_url; |
628 } | 643 } |
629 return Dart_DefaultCanonicalizeUrl(library_url, url); | 644 return Dart_DefaultCanonicalizeUrl(library_url, url); |
630 } | 645 } |
631 const char* url_string = NULL; | 646 const char* url_string = NULL; |
632 Dart_Handle result = Dart_StringToCString(url, &url_string); | 647 Dart_Handle result = Dart_StringToCString(url, &url_string); |
633 if (Dart_IsError(result)) { | 648 if (Dart_IsError(result)) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 snprintf(part_uri, len + 1, "%s/%s", library_url_string, url_string); | 811 snprintf(part_uri, len + 1, "%s/%s", library_url_string, url_string); |
797 Dart_Handle part_uri_obj = DartUtils::NewString(part_uri); | 812 Dart_Handle part_uri_obj = DartUtils::NewString(part_uri); |
798 free(part_uri); | 813 free(part_uri); |
799 return Dart_LoadSource(library, part_uri_obj, Dart_Null(), | 814 return Dart_LoadSource(library, part_uri_obj, Dart_Null(), |
800 Builtin::PartSource(id, url_string), 0, 0); | 815 Builtin::PartSource(id, url_string), 0, 0); |
801 } | 816 } |
802 // All cases should have been handled above. | 817 // All cases should have been handled above. |
803 UNREACHABLE(); | 818 UNREACHABLE(); |
804 return Dart_Null(); | 819 return Dart_Null(); |
805 } | 820 } |
| 821 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
806 | 822 |
807 | 823 |
808 void Loader::InitOnce() { | 824 void Loader::InitOnce() { |
809 loader_infos_lock_ = new Mutex(); | 825 loader_infos_lock_ = new Mutex(); |
810 } | 826 } |
811 | 827 |
812 | 828 |
813 Mutex* Loader::loader_infos_lock_; | 829 Mutex* Loader::loader_infos_lock_; |
814 Loader::LoaderInfo* Loader::loader_infos_ = NULL; | 830 Loader::LoaderInfo* Loader::loader_infos_ = NULL; |
815 intptr_t Loader::loader_infos_length_ = 0; | 831 intptr_t Loader::loader_infos_length_ = 0; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 MutexLocker ml(loader_infos_lock_); | 906 MutexLocker ml(loader_infos_lock_); |
891 Loader* loader = LoaderForLocked(dest_port_id); | 907 Loader* loader = LoaderForLocked(dest_port_id); |
892 if (loader == NULL) { | 908 if (loader == NULL) { |
893 return; | 909 return; |
894 } | 910 } |
895 loader->QueueMessage(message); | 911 loader->QueueMessage(message); |
896 } | 912 } |
897 | 913 |
898 } // namespace bin | 914 } // namespace bin |
899 } // namespace dart | 915 } // namespace dart |
OLD | NEW |