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

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

Issue 785303003: Add option for outputting a deferred loading mapping. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Whitespace 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 40a747308c37b9f4be70cc4cc5ec6662b73d3d74..ab497435968dc8bb098e2c36998ba02226ff9154 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -1733,6 +1733,10 @@ class OldEmitter implements Emitter {
emitDeferredBoilerPlate(mainBuffer, deferredLoadHashes);
+ if (compiler.deferredMapUri != null) {
+ outputDeferredMap();
+ }
+
// Static field initializations require the classes and compile-time
// constants to be set up.
emitStaticNonFinalFieldInitializations(mainBuffer, mainOutputUnit);
@@ -2270,6 +2274,18 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
..close();
}
+ void outputDeferredMap() {
+ Map mapping = new Map();
floitsch 2015/01/05 14:10:38 types.
sigurdm 2015/01/05 15:23:08 I changed it to Map<String, dynamic> If we want th
+ // Json does not support comments, so we embed the explanation in the
+ // data.
+ mapping["_comment"] = "This mapping shows which compiled `.js` files are "
+ "needed for a given deferred library import.";
+ mapping.addAll(compiler.deferredLoadTask.deferredMap());
+ compiler.outputProvider(compiler.deferredMapUri.path, 'deferred_map')
+ ..add(const JsonEncoder.withIndent(" ").convert(mapping))
+ ..close();
+ }
+
void invalidateCaches() {
if (!compiler.hasIncrementalSupport) return;
if (cachedElements.isEmpty) return;

Powered by Google App Engine
This is Rietveld 408576698