| 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" |
| 11 #include "bin/platform.h" | 11 #include "bin/platform.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 namespace bin { | 14 namespace bin { |
| 15 | 15 |
| 16 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { | 16 Builtin::builtin_lib_props Builtin::builtin_libraries_[] = { |
| 17 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */ | 17 /* { url_, source_, patch_url_, patch_source_, has_natives_ } */ |
| 18 { DartUtils::kBuiltinLibURL, _builtin_source_paths_, NULL, NULL, true }, | 18 { DartUtils::kBuiltinLibURL, _builtin_source_paths_, NULL, NULL, true }, |
| 19 { DartUtils::kIOLibURL, io_source_paths_, | 19 { DartUtils::kIOLibURL, io_source_paths_, |
| 20 DartUtils::kIOLibPatchURL, io_patch_paths_, true }, | 20 DartUtils::kIOLibPatchURL, io_patch_paths_, true }, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 Dart_Port Builtin::load_port_ = DART_ILLEGAL_PORT; | 23 Dart_Port Builtin::load_port_ = ILLEGAL_PORT; |
| 24 | 24 |
| 25 // Patch all the specified patch files in the array 'patch_files' into the | 25 // Patch all the specified patch files in the array 'patch_files' into the |
| 26 // library specified in 'library'. | 26 // library specified in 'library'. |
| 27 static void LoadPatchFiles(Dart_Handle library, | 27 static void LoadPatchFiles(Dart_Handle library, |
| 28 const char* patch_uri, | 28 const char* patch_uri, |
| 29 const char** patch_files) { | 29 const char** patch_files) { |
| 30 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { | 30 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { |
| 31 Dart_Handle patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]); | 31 Dart_Handle patch_src = DartUtils::ReadStringFromFile(patch_files[j + 1]); |
| 32 | 32 |
| 33 // Prepend the patch library URI to form a unique script URI for the patch. | 33 // Prepend the patch library URI to form a unique script URI for the patch. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); | 112 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_); |
| 113 Dart_Handle library = Dart_LookupLibrary(url); | 113 Dart_Handle library = Dart_LookupLibrary(url); |
| 114 if (Dart_IsError(library)) { | 114 if (Dart_IsError(library)) { |
| 115 library = LoadLibrary(url, id); | 115 library = LoadLibrary(url, id); |
| 116 } | 116 } |
| 117 return library; | 117 return library; |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace bin | 120 } // namespace bin |
| 121 } // namespace dart | 121 } // namespace dart |
| OLD | NEW |