Chromium Code Reviews| 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(); |
| + } |
| }); |
| } |