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

Unified Diff: sdk/lib/_internal/compiler/implementation/deferred_load.dart

Issue 368193004: Dart2js Avoid file-names of deferred .part-files from getting too long. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/deferred_load.dart
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
index ddf061c62e25b7dd1e5d0a46b67a12a20115803f..dffcbb9ecb23f56e47220ad002727de58ab19966 100644
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
@@ -57,6 +57,8 @@ import 'resolution/resolution.dart' show
TreeElements,
AnalyzableElementX;
+import "dart:math" show min;
+
/// A "hunk" of the program that will be loaded whenever one of its [imports]
/// are loaded.
///
@@ -564,9 +566,21 @@ class DeferredLoadTask extends CompilerTask {
void computeOutputUnitName(OutputUnit outputUnit) {
if (generatedNames[outputUnit] != null) return;
- String suggestedName = outputUnit.imports.map((import) {
+ Iterable<String> importNames = outputUnit.imports.map((import) {
return importDeferName[import];
- }).join('_');
+ });
+ String suggestedName = importNames.join('_');
Alan Knight 2014/07/07 20:08:07 Is this going to run into potential problems with
sigurdm 2014/07/08 07:19:58 We take care of the uniqueness a few lines further
+ // Avoid the name getting too long.
+ // Try to abbreviate the prefix-names
+ if (suggestedName.length > 15) {
+ suggestedName = importNames.map((name) {
+ return name.substring(0, min(2, name.length));
+ }).join('_');
+ }
+ // If this is still too long, truncate the whole name.
+ if (suggestedName.length > 15) {
+ suggestedName = suggestedName.substring(0, 15);
+ }
outputUnit.name = makeUnique(suggestedName, usedOutputUnitNames);
generatedNames[outputUnit] = outputUnit.name;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698