mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Fix gen_snapshot product mode build
BUG= R=rmacnak@google.com Review URL: https://codereview.chromium.org/2527473002 .
This commit is contained in:
parent
e63105555b
commit
ed47486f60
|
@ -741,15 +741,11 @@ static void SetupStubNativeResolver(size_t lib_index,
|
|||
// run after |SetupStubNativeResolversForPrecompilation| because the former
|
||||
// loads some libraries.
|
||||
static void SetupStubNativeResolvers() {
|
||||
Dart_Handle library_ids = Dart_GetLibraryIds();
|
||||
intptr_t library_ids_length;
|
||||
Dart_ListLength(library_ids, &library_ids_length);
|
||||
for (intptr_t i = 0; i < library_ids_length; i++) {
|
||||
Dart_Handle library_id_handle = Dart_ListGetAt(library_ids, i);
|
||||
DART_CHECK_VALID(library_id_handle);
|
||||
int64_t library_id;
|
||||
Dart_IntegerToInt64(library_id_handle, &library_id);
|
||||
Dart_Handle library = Dart_GetLibraryFromId(library_id);
|
||||
Dart_Handle libraries = Dart_GetLoadedLibraries();
|
||||
intptr_t libraries_length;
|
||||
Dart_ListLength(libraries, &libraries_length);
|
||||
for (intptr_t i = 0; i < libraries_length; i++) {
|
||||
Dart_Handle library = Dart_ListGetAt(libraries, i);
|
||||
DART_CHECK_VALID(library);
|
||||
Dart_NativeEntryResolver old_resolver = NULL;
|
||||
Dart_GetNativeResolver(library, &old_resolver);
|
||||
|
|
|
@ -2931,6 +2931,13 @@ DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library,
|
|||
*/
|
||||
DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library);
|
||||
|
||||
|
||||
/**
|
||||
* \return An array of libraries.
|
||||
*/
|
||||
DART_EXPORT Dart_Handle Dart_GetLoadedLibraries();
|
||||
|
||||
|
||||
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url);
|
||||
/* TODO(turnidge): Consider returning Dart_Null() when the library is
|
||||
* not found to distinguish that from a true error case. */
|
||||
|
|
|
@ -5514,6 +5514,26 @@ DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library) {
|
|||
}
|
||||
|
||||
|
||||
DART_EXPORT Dart_Handle Dart_GetLoadedLibraries() {
|
||||
DARTSCOPE(Thread::Current());
|
||||
Isolate* I = T->isolate();
|
||||
|
||||
const GrowableObjectArray& libs =
|
||||
GrowableObjectArray::Handle(Z, I->object_store()->libraries());
|
||||
int num_libs = libs.Length();
|
||||
|
||||
// Create new list and populate with the loaded libraries.
|
||||
Library& lib = Library::Handle();
|
||||
const Array& library_list = Array::Handle(Z, Array::New(num_libs));
|
||||
for (int i = 0; i < num_libs; i++) {
|
||||
lib ^= libs.At(i);
|
||||
ASSERT(!lib.IsNull());
|
||||
library_list.SetAt(i, lib);
|
||||
}
|
||||
return Api::NewHandle(T, library_list.raw());
|
||||
}
|
||||
|
||||
|
||||
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url) {
|
||||
DARTSCOPE(Thread::Current());
|
||||
const String& url_str = Api::UnwrapStringHandle(Z, url);
|
||||
|
|
Loading…
Reference in a new issue