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

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
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..6bb52ddde08384cbe5571826aced88b2ef99b01a 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 voidFunction();
floitsch 2014/09/11 09:01:27 typedefs are capitalized. I think "XCallback" is w
sigurdm 2014/09/11 12:06:44 Done.
+
+// Function that will be called every time a new deferred import is loaded.
+voidFunction librariesUpdatedHook;
floitsch 2014/09/11 09:01:27 deferredLoadHook ?
sigurdm 2014/09/11 12:06:44 Done.
+
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 && librariesUpdatedHook != null) {
+ librariesUpdatedHook();
+ }
});
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698