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

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: Cleanup js-generation 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..62ea9ea2b7c93882a7f565b7c9f34559be944362 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,8 @@ class OldEmitter implements Emitter {
String get lazyInitializerName
=> '${namer.isolateName}.${lazyInitializerProperty}';
String get initName => 'init';
+ String get deferredInitializedName => 'deferredInitialized';
+
String get makeConstListProperty
=> namer.getMappedInstanceName('makeConstantList');
@@ -1828,21 +1830,30 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
Map<OutputUnit, String> deferredLoadHashes) {
// Function for checking if a hunk is loaded given its hash.
buffer.write(jsAst.prettyPrint(
floitsch 2015/01/07 13:04:31 Put all these statements together into one string.
sigurdm 2015/01/07 13:37:13 Done.
- js('# = function(hunkHash) {'
+ js.statement('# = function(hunkHash) {'
' return !!$deferredInitializers[hunkHash];'
- '}', generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_LOADED)),
+ '};', generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_LOADED)),
+ compiler, monitor: compiler.dumpInfoTask));
+ buffer.write(jsAst.prettyPrint(
+ js.statement('$initName.$deferredInitializedName = new Object(null);'),
floitsch 2015/01/07 13:04:31 this looks like a bad "initName" of an embedded gl
sigurdm 2015/01/07 13:37:13 Changed it to an embedded global.
+ compiler, monitor: compiler.dumpInfoTask));
+ // Function for checking if a hunk is initialized given its hash.
+ buffer.write(jsAst.prettyPrint(
+ js.statement('# = function(hunkHash) {'
+ 'return $initName.$deferredInitializedName[hunkHash];'
+ '};',
+ generateEmbeddedGlobalAccess(embeddedNames.IS_HUNK_INITIALIZED)),
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})'
- '}',
+ js.statement('# = function(hunkHash) {'
+ '$deferredInitializers[hunkHash]('
+ '$globalsHolder, ${namer.currentIsolate});'
+ '$initName.deferredInitialized[hunkHash] = true;'
+ '};',
generateEmbeddedGlobalAccess(
embeddedNames.INITIALIZE_LOADED_HUNK)),
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