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

Unified Diff: runtime/bin/dartutils.cc

Issue 328923002: Lazy loading of deferred libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/bin/builtin_sources.gypi ('k') | runtime/lib/lib_prefix.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dartutils.cc
===================================================================
--- runtime/bin/dartutils.cc (revision 37317)
+++ runtime/bin/dartutils.cc (working copy)
@@ -25,7 +25,7 @@
const char* DartUtils::kDartScheme = "dart:";
const char* DartUtils::kDartExtensionScheme = "dart-ext:";
const char* DartUtils::kAsyncLibURL = "dart:async";
-const char* DartUtils::kBuiltinLibURL = "dart:builtin";
+const char* DartUtils::kBuiltinLibURL = "dart:_builtin";
const char* DartUtils::kCoreLibURL = "dart:core";
const char* DartUtils::kInternalLibURL = "dart:_internal";
const char* DartUtils::kIsolateLibURL = "dart:isolate";
@@ -679,7 +679,9 @@
intptr_t num_bytes = 0;
Dart_Handle result = Dart_ListLength(data, &num_bytes);
- DART_CHECK_VALID(result);
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(num_bytes));
Dart_ListGetAsBytes(data, 0, buffer, num_bytes);
@@ -739,6 +741,27 @@
}
+// Callback function that gets called from dartutils when there are
+// no more outstanding load requests. Invoke Dart core library function
+// that completes futures of loadLibrary calls (deferred library loading).
+// Invoking this function finalizes newly loaded classes as a side
+// effect.
+void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) {
+ Dart_Handle corelib_url = DartUtils::NewString(DartUtils::kCoreLibURL);
+ DART_CHECK_VALID(corelib_url);
+ Dart_Handle corelib = Dart_LookupLibrary(corelib_url);
+ DART_CHECK_VALID(corelib);
+ Dart_Handle res =
+ Dart_Invoke(corelib,
+ DartUtils::NewString("_completeDeferredLoads"),
+ 0,
+ NULL);
+ if (Dart_IsError(res)) {
+ Dart_PropagateError(res);
+ }
+}
+
+
Dart_Handle DartUtils::LoadSource(Dart_Handle library,
Dart_Handle url,
Dart_LibraryTag tag,
« no previous file with comments | « runtime/bin/builtin_sources.gypi ('k') | runtime/lib/lib_prefix.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698