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

Side by Side Diff: pkg/compiler/lib/src/source_file_provider.dart

Issue 2865643004: dart2js: Always print input and output sizes and compile time (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 typedef void MessageCallback(String message); 231 typedef void MessageCallback(String message);
232 232
233 class RandomAccessFileOutputProvider implements CompilerOutput { 233 class RandomAccessFileOutputProvider implements CompilerOutput {
234 final Uri out; 234 final Uri out;
235 final Uri sourceMapOut; 235 final Uri sourceMapOut;
236 final Uri resolutionOutput; 236 final Uri resolutionOutput;
237 final MessageCallback onInfo; 237 final MessageCallback onInfo;
238 final MessageCallback onFailure; 238 final MessageCallback onFailure;
239 239
240 int totalCharactersWritten = 0; 240 int totalCharactersWritten = 0;
241 List<String> allOutputFiles = new List<String>(); 241 int totalCharactersWrittenPrimary = 0;
242 int totalCharactersWrittenJavaScript = 0;
243
244 List<String> allOutputFiles = <String>[];
242 245
243 RandomAccessFileOutputProvider(this.out, this.sourceMapOut, 246 RandomAccessFileOutputProvider(this.out, this.sourceMapOut,
244 {this.onInfo, this.onFailure, this.resolutionOutput}); 247 {this.onInfo, this.onFailure, this.resolutionOutput});
245 248
246 static Uri computePrecompiledUri(Uri out) { 249 static Uri computePrecompiledUri(Uri out) {
247 String extension = 'precompiled.js'; 250 String extension = 'precompiled.js';
248 String outPath = out.path; 251 String outPath = out.path;
249 if (outPath.endsWith('.js')) { 252 if (outPath.endsWith('.js')) {
250 outPath = outPath.substring(0, outPath.length - 3); 253 outPath = outPath.substring(0, outPath.length - 3);
251 return out.resolve('$outPath.$extension'); 254 return out.resolve('$outPath.$extension');
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 while (offset < data.length) { 331 while (offset < data.length) {
329 output.writeStringSync( 332 output.writeStringSync(
330 data.substring(offset, math.min(offset + chunkSize, data.length))); 333 data.substring(offset, math.min(offset + chunkSize, data.length)));
331 offset += chunkSize; 334 offset += chunkSize;
332 } 335 }
333 charactersWritten += data.length; 336 charactersWritten += data.length;
334 } 337 }
335 338
336 onDone() { 339 onDone() {
337 output.closeSync(); 340 output.closeSync();
341 totalCharactersWritten += charactersWritten;
338 if (isPrimaryOutput) { 342 if (isPrimaryOutput) {
339 totalCharactersWritten += charactersWritten; 343 totalCharactersWrittenPrimary += charactersWritten;
344 }
345 if (type == OutputType.js || type == OutputType.jsPart) {
346 totalCharactersWrittenJavaScript += charactersWritten;
340 } 347 }
341 } 348 }
342 349
343 return new _OutputSinkWrapper(writeStringSync, onDone); 350 return new _OutputSinkWrapper(writeStringSync, onDone);
344 } 351 }
345 } 352 }
346 353
347 class _OutputSinkWrapper extends OutputSink { 354 class _OutputSinkWrapper extends OutputSink {
348 var onAdd, onClose; 355 var onAdd, onClose;
349 356
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 resolvedUri = file; 416 resolvedUri = file;
410 break; 417 break;
411 } 418 }
412 } 419 }
413 } 420 }
414 List<int> result = await readUtf8BytesFromUri(resolvedUri); 421 List<int> result = await readUtf8BytesFromUri(resolvedUri);
415 sourceFiles[uri] = sourceFiles[resolvedUri]; 422 sourceFiles[uri] = sourceFiles[resolvedUri];
416 return result; 423 return result;
417 } 424 }
418 } 425 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698