| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { | 28 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { |
| 29 Dart_Handle patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]); | 29 Dart_Handle patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]); |
| 30 | 30 |
| 31 // Prepend the patch library URI to form a unique script URI for the patch. | 31 // Prepend the patch library URI to form a unique script URI for the patch. |
| 32 intptr_t len = snprintf(NULL, 0, "%s/%s", patch_uri, patch_files[j]); | 32 intptr_t len = snprintf(NULL, 0, "%s/%s", patch_uri, patch_files[j]); |
| 33 char* patch_filename = reinterpret_cast<char*>(malloc(len + 1)); | 33 char* patch_filename = reinterpret_cast<char*>(malloc(len + 1)); |
| 34 snprintf(patch_filename, len + 1, "%s/%s", patch_uri, patch_files[j]); | 34 snprintf(patch_filename, len + 1, "%s/%s", patch_uri, patch_files[j]); |
| 35 Dart_Handle patch_file_uri = DartUtils::NewString(patch_filename); | 35 Dart_Handle patch_file_uri = DartUtils::NewString(patch_filename); |
| 36 free(patch_filename); | 36 free(patch_filename); |
| 37 | 37 |
| 38 DART_CHECK_VALID(Dart_LoadPatch(library, patch_file_uri, patch_src)); | 38 DART_CHECK_VALID(Dart_LibraryLoadPatch(library, patch_file_uri, patch_src)); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 Dart_Handle Builtin::Source(BuiltinLibraryId id) { | 43 Dart_Handle Builtin::Source(BuiltinLibraryId id) { |
| 44 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == | 44 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == |
| 45 kInvalidLibrary); | 45 kInvalidLibrary); |
| 46 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); | 46 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); |
| 47 | 47 |
| 48 // Try to read the source using the path specified for the uri. | 48 // Try to read the source using the path specified for the uri. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 builtin_libraries_[id].patch_url_, | 104 builtin_libraries_[id].patch_url_, |
| 105 builtin_libraries_[id].patch_paths_); | 105 builtin_libraries_[id].patch_paths_); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 DART_CHECK_VALID(library); | 108 DART_CHECK_VALID(library); |
| 109 return library; | 109 return library; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace bin | 112 } // namespace bin |
| 113 } // namespace dart | 113 } // namespace dart |
| OLD | NEW |