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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 562853002: Recompute librariesByName after loading a deferred library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index e56c3c839211457c7cbe2cf3ffe66fd962ab177a..9f90fa817d8165391dda4f4df3aa247a798d109f 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -3257,6 +3257,11 @@ LoadLibraryFunctionType _loadLibraryWrapper(String loadId) {
final Map<String, Future<Null>> _loadingLibraries = <String, Future<Null>>{};
final Set<String> _loadedLibraries = new Set<String>();
+typedef void DeferredLoadCallback();
+
+// Function that will be called every time a new deferred import is loaded.
+DeferredLoadCallback deferredLoadHook;
+
Future<Null> loadDeferredLibrary(String loadId) {
// For each loadId there is a list of hunk-uris to load, and a corresponding
// list of hashes. These are stored in the app-global scope.
@@ -3277,7 +3282,10 @@ Future<Null> loadDeferredLibrary(String loadId) {
// TODO(floitsch): Replace unsafe access to embedded global.
JS('void', 'init.initializeLoadedHunk(#)', hash);
}
- _loadedLibraries.add(loadId);
+ bool updated = _loadedLibraries.add(loadId);
+ if (updated && deferredLoadHook != null) {
+ deferredLoadHook();
+ }
});
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698