Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
| 9 import 'package:front_end/incremental_kernel_generator.dart'; | 9 import 'package:front_end/incremental_kernel_generator.dart'; |
| 10 import 'package:front_end/incremental_resolved_ast_generator.dart'; | 10 import 'package:front_end/incremental_resolved_ast_generator.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 | 56 |
| 57 /// The current file system state. | 57 /// The current file system state. |
| 58 final FileSystemState _fsState; | 58 final FileSystemState _fsState; |
| 59 | 59 |
| 60 /// The byte storage to get and put serialized data. | 60 /// The byte storage to get and put serialized data. |
| 61 final ByteStore _byteStore; | 61 final ByteStore _byteStore; |
| 62 | 62 |
| 63 /// The URI of the program entry point. | 63 /// The URI of the program entry point. |
| 64 final Uri _entryPoint; | 64 final Uri _entryPoint; |
| 65 | 65 |
| 66 /// Latest compilation signatures produced by [computeDelta] for libraries. | |
| 67 final Map<Uri, String> _uriToLatestSignature = {}; | |
|
Siggi Cherem (dart-lang)
2017/05/17 18:15:10
optional style nit: consider dropping "_uriTo" fro
scheglov
2017/05/17 22:04:05
OK
Will do in https://codereview.chromium.org/2893
| |
| 68 | |
| 66 /// The set of absolute file URIs that were reported through [invalidate] | 69 /// The set of absolute file URIs that were reported through [invalidate] |
| 67 /// and not checked for actual changes yet. | 70 /// and not checked for actual changes yet. |
| 68 final Set<Uri> _invalidatedFiles = new Set<Uri>(); | 71 final Set<Uri> _invalidatedFiles = new Set<Uri>(); |
| 69 | 72 |
| 70 IncrementalKernelGeneratorImpl( | 73 IncrementalKernelGeneratorImpl( |
| 71 this._options, this._uriTranslator, this._entryPoint) | 74 this._options, this._uriTranslator, this._entryPoint) |
| 72 : _logger = _options.logger, | 75 : _logger = _options.logger, |
| 73 _fsState = new FileSystemState(_options.fileSystem, _uriTranslator), | 76 _fsState = new FileSystemState(_options.fileSystem, _uriTranslator), |
| 74 _byteStore = _options.byteStore; | 77 _byteStore = _options.byteStore; |
| 75 | 78 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 95 List<_LibraryCycleResult> results = []; | 98 List<_LibraryCycleResult> results = []; |
| 96 await _logger.runAsync('Compute results for cycles', () async { | 99 await _logger.runAsync('Compute results for cycles', () async { |
| 97 for (LibraryCycle cycle in cycles) { | 100 for (LibraryCycle cycle in cycles) { |
| 98 _LibraryCycleResult result = | 101 _LibraryCycleResult result = |
| 99 await _compileCycle(nameRoot, dillTarget, cycle); | 102 await _compileCycle(nameRoot, dillTarget, cycle); |
| 100 results.add(result); | 103 results.add(result); |
| 101 } | 104 } |
| 102 }); | 105 }); |
| 103 | 106 |
| 104 Program program = new Program(nameRoot: nameRoot); | 107 Program program = new Program(nameRoot: nameRoot); |
| 108 | |
| 109 // Add affected libraries (with different signatures). | |
| 105 for (_LibraryCycleResult result in results) { | 110 for (_LibraryCycleResult result in results) { |
| 106 program.libraries.addAll(result.kernelLibraries); | 111 for (Library library in result.kernelLibraries) { |
| 112 Uri uri = library.importUri; | |
| 113 if (_uriToLatestSignature[uri] != result.signature) { | |
| 114 _uriToLatestSignature[uri] = result.signature; | |
| 115 program.libraries.add(library); | |
| 116 } | |
| 117 } | |
| 107 } | 118 } |
| 108 | 119 |
| 120 // TODO(scheglov) Add libraries which import changed libraries. | |
| 121 | |
| 109 return new DeltaProgram(program); | 122 return new DeltaProgram(program); |
| 110 }); | 123 }); |
| 111 } | 124 } |
| 112 | 125 |
| 113 @override | 126 @override |
| 114 void invalidate(Uri uri) { | 127 void invalidate(Uri uri) { |
| 115 _invalidatedFiles.add(uri); | 128 _invalidatedFiles.add(uri); |
| 116 } | 129 } |
| 117 | 130 |
| 118 @override | 131 @override |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 /// TODO(scheglov) Use API signatures. | 243 /// TODO(scheglov) Use API signatures. |
| 231 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. | 244 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. |
| 232 final String signature; | 245 final String signature; |
| 233 | 246 |
| 234 /// Kernel libraries for libraries in the [cycle]. Dependencies are not | 247 /// Kernel libraries for libraries in the [cycle]. Dependencies are not |
| 235 /// included, they were returned as results for preceding cycles. | 248 /// included, they were returned as results for preceding cycles. |
| 236 final List<Library> kernelLibraries; | 249 final List<Library> kernelLibraries; |
| 237 | 250 |
| 238 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); | 251 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); |
| 239 } | 252 } |
| OLD | NEW |