| 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 | 6 |
| 7 import 'package:front_end/incremental_kernel_generator.dart'; | 7 import 'package:front_end/incremental_kernel_generator.dart'; |
| 8 import 'package:front_end/src/base/performace_logger.dart'; | 8 import 'package:front_end/src/base/performace_logger.dart'; |
| 9 import 'package:front_end/src/base/processed_options.dart'; | 9 import 'package:front_end/src/base/processed_options.dart'; |
| 10 import 'package:front_end/src/fasta/uri_translator.dart'; | 10 import 'package:front_end/src/fasta/uri_translator.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 /// The logger to report compilation progress. | 27 /// The logger to report compilation progress. |
| 28 final PerformanceLog _logger; | 28 final PerformanceLog _logger; |
| 29 | 29 |
| 30 /// The URI of the program entry point. | 30 /// The URI of the program entry point. |
| 31 final Uri _entryPoint; | 31 final Uri _entryPoint; |
| 32 | 32 |
| 33 /// The function to notify when files become used or unused, or `null`. | 33 /// The function to notify when files become used or unused, or `null`. |
| 34 final WatchUsedFilesFn _watchFn; | 34 final WatchUsedFilesFn _watchFn; |
| 35 | 35 |
| 36 /// TODO(scheglov) document | 36 /// The [KernelDriver] that is used to compute kernels. |
| 37 KernelDriver _driver; | 37 KernelDriver _driver; |
| 38 | 38 |
| 39 /// Latest compilation signatures produced by [computeDelta] for libraries. | 39 /// Latest compilation signatures produced by [computeDelta] for libraries. |
| 40 final Map<Uri, String> _latestSignature = {}; | 40 final Map<Uri, String> _latestSignature = {}; |
| 41 | 41 |
| 42 /// The object that provides additional information for tests. | 42 /// The object that provides additional information for tests. |
| 43 _TestView _testView; | 43 _TestView _testView; |
| 44 | 44 |
| 45 IncrementalKernelGeneratorImpl( | 45 IncrementalKernelGeneratorImpl(ProcessedOptions options, |
| 46 ProcessedOptions options, UriTranslator uriTranslator, this._entryPoint, | 46 UriTranslator uriTranslator, List<int> sdkOutlineBytes, this._entryPoint, |
| 47 {WatchUsedFilesFn watch}) | 47 {WatchUsedFilesFn watch}) |
| 48 : _logger = options.logger, | 48 : _logger = options.logger, |
| 49 _watchFn = watch { | 49 _watchFn = watch { |
| 50 _testView = new _TestView(this); | 50 _testView = new _TestView(this); |
| 51 | 51 |
| 52 Future<Null> onFileAdded(Uri uri) { | 52 Future<Null> onFileAdded(Uri uri) { |
| 53 if (_watchFn != null) { | 53 if (_watchFn != null) { |
| 54 return _watchFn(uri, true); | 54 return _watchFn(uri, true); |
| 55 } | 55 } |
| 56 return new Future.value(); | 56 return new Future.value(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 _driver = | 59 _driver = new KernelDriver(options, uriTranslator, |
| 60 new KernelDriver(options, uriTranslator, fileAddedFn: onFileAdded); | 60 sdkOutlineBytes: sdkOutlineBytes, fileAddedFn: onFileAdded); |
| 61 } | 61 } |
| 62 | 62 |
| 63 /// Return the object that provides additional information for tests. | 63 /// Return the object that provides additional information for tests. |
| 64 @visibleForTesting | 64 @visibleForTesting |
| 65 _TestView get test => _testView; | 65 _TestView get test => _testView; |
| 66 | 66 |
| 67 @override | 67 @override |
| 68 Future<DeltaProgram> computeDelta() async { | 68 Future<DeltaProgram> computeDelta() async { |
| 69 return await _logger.runAsync('Compute delta', () async { | 69 return await _logger.runAsync('Compute delta', () async { |
| 70 KernelResult kernelResult = await _driver.getKernel(_entryPoint); | 70 KernelResult kernelResult = await _driver.getKernel(_entryPoint); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 @visibleForTesting | 144 @visibleForTesting |
| 145 class _TestView { | 145 class _TestView { |
| 146 final IncrementalKernelGeneratorImpl _generator; | 146 final IncrementalKernelGeneratorImpl _generator; |
| 147 | 147 |
| 148 _TestView(this._generator); | 148 _TestView(this._generator); |
| 149 | 149 |
| 150 /// The [KernelDriver] that is used to actually compile. | 150 /// The [KernelDriver] that is used to actually compile. |
| 151 KernelDriver get driver => _generator._driver; | 151 KernelDriver get driver => _generator._driver; |
| 152 } | 152 } |
| OLD | NEW |