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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 837903002: Fix deferred loading with multiple apps on same page. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressing comments Created 5 years, 11 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: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index 95ea5d973d6a6062230a42196ffc443c6c052dfd..f6b9a419d0ae12ed6adb5863d3fd356cd5b3b445 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -157,6 +157,7 @@ class OldEmitter implements Emitter {
String get lazyInitializerName
=> '${namer.isolateName}.${lazyInitializerProperty}';
String get initName => 'init';
+
String get makeConstListProperty
=> namer.getMappedInstanceName('makeConstantList');
@@ -1826,23 +1827,34 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
/// Emits support-code for deferred loading into [buffer].
void emitDeferredBoilerPlate(CodeBuffer buffer,
Map<OutputUnit, String> deferredLoadHashes) {
- // Function for checking if a hunk is loaded given its hash.
- buffer.write(jsAst.prettyPrint(
- js('# = function(hunkHash) {'
- ' return !!$deferredInitializers[hunkHash];'
- '}', generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_LOADED)),
- compiler, monitor: compiler.dumpInfoTask));
- buffer.write('$N');
- // Function for initializing a loaded hunk, given its hash.
- buffer.write(jsAst.prettyPrint(
- js('# = function(hunkHash) {'
- ' $deferredInitializers[hunkHash]('
- '$globalsHolder, ${namer.currentIsolate})'
- '}',
- generateEmbeddedGlobalAccess(
- embeddedNames.INITIALIZE_LOADED_HUNK)),
+ jsAst.Statement functions = js.statement('''
+ {
+ // Function for checking if a hunk is loaded given its hash.
+ #isHunkLoaded = function(hunkHash) {
+ return !!$deferredInitializers[hunkHash];
+ };
+ #deferredInitialized = new Object(null);
+ // Function for checking if a hunk is initialized given its hash.
+ #isHunkInitialized = function(hunkHash) {
+ return #deferredInitialized[hunkHash];
+ };
+ // Function for initializing a loaded hunk, given its hash.
+ #initializeLoadedHunk = function(hunkHash) {
+ $deferredInitializers[hunkHash](
+ $globalsHolder, ${namer.currentIsolate});
+ #deferredInitialized[hunkHash] = true;
+ };
+ }
+ ''', {"isHunkLoaded": generateEmbeddedGlobalAccess(
+ embeddedNames.IS_HUNK_LOADED),
+ "isHunkInitialized": generateEmbeddedGlobalAccess(
+ embeddedNames.IS_HUNK_INITIALIZED),
+ "initializeLoadedHunk": generateEmbeddedGlobalAccess(
+ embeddedNames.INITIALIZE_LOADED_HUNK),
+ "deferredInitialized": generateEmbeddedGlobalAccess(
+ embeddedNames.DEFERRED_INITIALIZED)});
+ buffer.write(jsAst.prettyPrint(functions,
compiler, monitor: compiler.dumpInfoTask));
- buffer.write('$N');
// Write a javascript mapping from Deferred import load ids (derrived
// from the import prefix.) to a list of lists of uris of hunks to load,
// and a corresponding mapping to a list of hashes used by
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698