Index: runtime/vm/dart_api_impl.cc |
=================================================================== |
--- runtime/vm/dart_api_impl.cc (revision 37402) |
+++ runtime/vm/dart_api_impl.cc (working copy) |
@@ -5106,6 +5106,37 @@ |
} |
+// Finalizes classes and invokes Dart core library function that completes |
+// futures of loadLibrary calls (deferred library loading). |
+DART_EXPORT Dart_Handle Dart_FinalizeLoading() { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ CHECK_CALLBACK_STATE(isolate); |
+ |
+ // Finalize all classes if needed. |
+ Dart_Handle state = Api::CheckIsolateState(isolate); |
+ if (::Dart_IsError(state)) { |
+ return state; |
+ } |
+ |
+ const Library& corelib = Library::Handle(isolate, Library::CoreLibrary()); |
+ const String& function_name = |
+ String::Handle(isolate, String::New("_completeDeferredLoads")); |
+ const Function& function = |
+ Function::Handle(isolate, |
+ corelib.LookupFunctionAllowPrivate(function_name)); |
+ ASSERT(!function.IsNull()); |
+ const Array& args = Array::empty_array(); |
+ |
+ const Object& res = |
+ Object::Handle(isolate, DartEntry::InvokeFunction(function, args)); |
+ if (res.IsError() || res.IsUnhandledException()) { |
+ return Api::NewHandle(isolate, res.raw()); |
+ } |
+ return Api::Success(); |
+} |
+ |
+ |
DART_EXPORT Dart_Handle Dart_SetNativeResolver( |
Dart_Handle library, |
Dart_NativeEntryResolver resolver, |