| 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/dfe.h" | 10 #include "bin/dfe.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 Dart_Handle library, | 636 Dart_Handle library, |
| 637 Dart_Handle url, | 637 Dart_Handle url, |
| 638 const char* library_url_string, | 638 const char* library_url_string, |
| 639 const char* url_string) { | 639 const char* url_string) { |
| 640 return Dart_Null(); | 640 return Dart_Null(); |
| 641 } | 641 } |
| 642 #else | 642 #else |
| 643 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, | 643 Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, |
| 644 Dart_Handle library, | 644 Dart_Handle library, |
| 645 Dart_Handle url) { | 645 Dart_Handle url) { |
| 646 if (dfe.UseDartFrontend()) { | |
| 647 Dart_Isolate current = Dart_CurrentIsolate(); | |
| 648 if (!Dart_IsServiceIsolate(current) && !Dart_IsKernelIsolate(current)) { | |
| 649 // When using DFE the library tag handler should be called only when we | |
| 650 // are reloading scripts. | |
| 651 // TODO(asiva) We need to ensure that the kernel and service isolates | |
| 652 // and the spawnURI paths are always loaded from a kernel IR and do | |
| 653 // not use this path. | |
| 654 if (tag == Dart_kScriptTag) { | |
| 655 return dfe.ReloadScript(current, url); | |
| 656 } | |
| 657 } | |
| 658 } | |
| 659 if (tag == Dart_kCanonicalizeUrl) { | 646 if (tag == Dart_kCanonicalizeUrl) { |
| 660 Dart_Handle library_url = Dart_LibraryUrl(library); | 647 Dart_Handle library_url = Dart_LibraryUrl(library); |
| 661 if (Dart_IsError(library_url)) { | 648 if (Dart_IsError(library_url)) { |
| 662 return library_url; | 649 return library_url; |
| 663 } | 650 } |
| 664 return Dart_DefaultCanonicalizeUrl(library_url, url); | 651 return Dart_DefaultCanonicalizeUrl(library_url, url); |
| 665 } | 652 } |
| 653 if (dfe.UseDartFrontend()) { |
| 654 Dart_Isolate current = Dart_CurrentIsolate(); |
| 655 if (!Dart_IsServiceIsolate(current) && !Dart_IsKernelIsolate(current)) { |
| 656 // When using DFE the library tag handler should be called only when we |
| 657 // are reloading scripts. |
| 658 ASSERT(tag == Dart_kScriptTag); |
| 659 return dfe.ReloadScript(current, url); |
| 660 } |
| 661 // TODO(asiva) We need to ensure that the kernel and service isolates |
| 662 // are always loaded from a kernel IR and do not use this path. |
| 663 } |
| 666 const char* url_string = NULL; | 664 const char* url_string = NULL; |
| 667 Dart_Handle result = Dart_StringToCString(url, &url_string); | 665 Dart_Handle result = Dart_StringToCString(url, &url_string); |
| 668 if (Dart_IsError(result)) { | 666 if (Dart_IsError(result)) { |
| 669 return result; | 667 return result; |
| 670 } | 668 } |
| 671 | 669 |
| 672 // Special case for handling dart: imports and parts. | 670 // Special case for handling dart: imports and parts. |
| 673 if (tag != Dart_kScriptTag) { | 671 if (tag != Dart_kScriptTag) { |
| 674 // Grab the library's url. | 672 // Grab the library's url. |
| 675 Dart_Handle library_url = Dart_LibraryUrl(library); | 673 Dart_Handle library_url = Dart_LibraryUrl(library); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 MutexLocker ml(loader_infos_lock_); | 924 MutexLocker ml(loader_infos_lock_); |
| 927 Loader* loader = LoaderForLocked(dest_port_id); | 925 Loader* loader = LoaderForLocked(dest_port_id); |
| 928 if (loader == NULL) { | 926 if (loader == NULL) { |
| 929 return; | 927 return; |
| 930 } | 928 } |
| 931 loader->QueueMessage(message); | 929 loader->QueueMessage(message); |
| 932 } | 930 } |
| 933 | 931 |
| 934 } // namespace bin | 932 } // namespace bin |
| 935 } // namespace dart | 933 } // namespace dart |
| OLD | NEW |