| 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 "vm/bootstrap.h" | 5 #include "vm/bootstrap.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, | 184 static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag, |
| 185 Dart_Handle library, | 185 Dart_Handle library, |
| 186 Dart_Handle uri) { | 186 Dart_Handle uri) { |
| 187 Isolate* isolate = Isolate::Current(); | 187 Isolate* isolate = Isolate::Current(); |
| 188 if (!Dart_IsLibrary(library)) { | 188 if (!Dart_IsLibrary(library)) { |
| 189 return Dart_NewApiError("not a library"); | 189 return Dart_NewApiError("not a library"); |
| 190 } | 190 } |
| 191 if (!Dart_IsString(uri)) { | 191 if (!Dart_IsString(uri)) { |
| 192 return Dart_NewApiError("uri is not a string"); | 192 return Dart_NewApiError("uri is not a string"); |
| 193 } | 193 } |
| 194 if (tag == kCanonicalizeUrl) { | 194 if (tag == Dart_kCanonicalizeUrl) { |
| 195 // In the boot strap loader we do not try and do any canonicalization. | 195 // In the boot strap loader we do not try and do any canonicalization. |
| 196 return uri; | 196 return uri; |
| 197 } | 197 } |
| 198 const String& uri_str = Api::UnwrapStringHandle(isolate, uri); | 198 const String& uri_str = Api::UnwrapStringHandle(isolate, uri); |
| 199 ASSERT(!uri_str.IsNull()); | 199 ASSERT(!uri_str.IsNull()); |
| 200 if (tag == kImportTag) { | 200 if (tag == Dart_kImportTag) { |
| 201 // We expect the core bootstrap libraries to only import other | 201 // We expect the core bootstrap libraries to only import other |
| 202 // core bootstrap libraries. | 202 // core bootstrap libraries. |
| 203 // We have precreated all the bootstrap library objects hence | 203 // We have precreated all the bootstrap library objects hence |
| 204 // we do not expect to be called back with the tag set to kImportTag. | 204 // we do not expect to be called back with the tag set to kImportTag. |
| 205 // The bootstrap process explicitly loads all the libraries one by one. | 205 // The bootstrap process explicitly loads all the libraries one by one. |
| 206 return Dart_NewApiError("Invalid import of '%s' in a bootstrap library", | 206 return Dart_NewApiError("Invalid import of '%s' in a bootstrap library", |
| 207 uri_str.ToCString()); | 207 uri_str.ToCString()); |
| 208 } | 208 } |
| 209 ASSERT(tag == kSourceTag); | 209 ASSERT(tag == Dart_kSourceTag); |
| 210 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); | 210 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 211 ASSERT(!lib.IsNull()); | 211 ASSERT(!lib.IsNull()); |
| 212 return LoadPartSource(isolate, lib, uri_str); | 212 return LoadPartSource(isolate, lib, uri_str); |
| 213 } | 213 } |
| 214 | 214 |
| 215 | 215 |
| 216 static RawError* LoadPatchFiles(Isolate* isolate, | 216 static RawError* LoadPatchFiles(Isolate* isolate, |
| 217 const Library& lib, | 217 const Library& lib, |
| 218 const String& patch_uri, | 218 const String& patch_uri, |
| 219 const char** patch_files) { | 219 const char** patch_files) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Exit the Dart scope. | 316 // Exit the Dart scope. |
| 317 Dart_ExitScope(); | 317 Dart_ExitScope(); |
| 318 | 318 |
| 319 // Restore the library tag handler for the isolate. | 319 // Restore the library tag handler for the isolate. |
| 320 isolate->set_library_tag_handler(saved_tag_handler); | 320 isolate->set_library_tag_handler(saved_tag_handler); |
| 321 | 321 |
| 322 return error.raw(); | 322 return error.raw(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace dart | 325 } // namespace dart |
| OLD | NEW |