Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1389)

Unified Diff: runtime/vm/unit_test.cc

Issue 529203004: Cleanup resource loading of the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unit_test.cc
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 3595d4fb872b0c24a406cf31a9dc1ad040833e6d..2e353eaa1fa9cf1dbfed172493efcd7fe90f6ef7 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -70,6 +70,10 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
return result;
}
+ Dart_Handle builtin_lib =
+ Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
+ DART_CHECK_VALID(builtin_lib);
+
bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_chars);
bool is_io_library = DartUtils::IsDartIOLibURL(library_url_string);
if (tag == Dart_kCanonicalizeUrl) {
@@ -78,9 +82,6 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
if (is_dart_scheme_url || is_io_library) {
return url;
}
- Dart_Handle builtin_lib =
- Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- DART_CHECK_VALID(builtin_lib);
Dart_Handle library_url = Dart_LibraryUrl(library);
if (Dart_IsError(library_url)) {
@@ -94,7 +95,7 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
if (DartUtils::IsDartIOLibURL(url_chars)) {
return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
} else if (DartUtils::IsDartBuiltinLibURL(url_chars)) {
- return Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
+ return builtin_lib;
} else {
return DartUtils::NewError("Do not know how to load '%s'", url_chars);
}
@@ -107,7 +108,15 @@ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
url_chars),
0, 0);
}
- return DartUtils::LoadSource(library, url, tag, url_chars);
+ // Do sync loading since unit_test doesn't support async.
+ Dart_Handle source = DartUtils::ReadStringFromFile(url_chars);
+ EXPECT_VALID(source);
+ if (tag == Dart_kImportTag) {
+ return Dart_LoadLibrary(url, source, 0, 0);
+ } else {
+ ASSERT(tag == Dart_kSourceTag);
+ return Dart_LoadSource(library, url, source, 0, 0);
+ }
}
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698