| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/service_isolate.h" | 5 #include "vm/service_isolate.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 ASSERT(*path != '\0'); | 648 ASSERT(*path != '\0'); |
| 649 // Skip the '/'. | 649 // Skip the '/'. |
| 650 path++; | 650 path++; |
| 651 if (strcmp(name, path) == 0) { | 651 if (strcmp(name, path) == 0) { |
| 652 const uint8_t* str = Resources::Resource(i); | 652 const uint8_t* str = Resources::Resource(i); |
| 653 intptr_t length = Resources::Length(i); | 653 intptr_t length = Resources::Length(i); |
| 654 return Dart_NewStringFromUTF8(str, length); | 654 return Dart_NewStringFromUTF8(str, length); |
| 655 } | 655 } |
| 656 i++; | 656 i++; |
| 657 } | 657 } |
| 658 FATAL1("vm-service: Could not find embedded source file: %s ", name); |
| 658 return Dart_Null(); | 659 return Dart_Null(); |
| 659 } | 660 } |
| 660 | 661 |
| 661 | 662 |
| 662 Dart_Handle ServiceIsolate::LibraryTagHandler(Dart_LibraryTag tag, | 663 Dart_Handle ServiceIsolate::LibraryTagHandler(Dart_LibraryTag tag, |
| 663 Dart_Handle library, | 664 Dart_Handle library, |
| 664 Dart_Handle url) { | 665 Dart_Handle url) { |
| 665 if (tag == Dart_kCanonicalizeUrl) { | 666 if (tag == Dart_kCanonicalizeUrl) { |
| 666 // url is already canonicalized. | 667 // url is already canonicalized. |
| 667 return url; | 668 return url; |
| 668 } | 669 } |
| 669 if (tag != Dart_kSourceTag) { | 670 if (tag != Dart_kSourceTag) { |
| 670 FATAL("ServiceIsolate::LibraryTagHandler encountered an unexpected tag."); | 671 FATAL("ServiceIsolate::LibraryTagHandler encountered an unexpected tag."); |
| 671 } | 672 } |
| 672 ASSERT(tag == Dart_kSourceTag); | 673 ASSERT(tag == Dart_kSourceTag); |
| 673 const char* url_string = NULL; | 674 const char* url_string = NULL; |
| 674 Dart_Handle result = Dart_StringToCString(url, &url_string); | 675 Dart_Handle result = Dart_StringToCString(url, &url_string); |
| 675 if (Dart_IsError(result)) { | 676 if (Dart_IsError(result)) { |
| 676 return result; | 677 return result; |
| 677 } | 678 } |
| 678 Dart_Handle source = GetSource(url_string); | 679 Dart_Handle source = GetSource(url_string); |
| 679 if (Dart_IsError(source)) { | 680 if (Dart_IsError(source)) { |
| 680 return source; | 681 return source; |
| 681 } | 682 } |
| 682 return Dart_LoadSource(library, url, source, 0, 0); | 683 return Dart_LoadSource(library, url, source, 0, 0); |
| 683 } | 684 } |
| 684 | 685 |
| 685 } // namespace dart | 686 } // namespace dart |
| OLD | NEW |