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

Unified Diff: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart

Issue 2933153002: Report unused files to watch. (Closed)
Patch Set: Created 3 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
Index: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
index 416f22ae151cf02021d1c738651fb6ae5fe2d564..7d320f7c701fc55bd5df039f58c07a04aec8f397 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -60,6 +60,9 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
/// The URI of the program entry point.
final Uri _entryPoint;
+ /// The function to notify when files become used or unused, or `null`.
+ final WatchUsedFilesFn _watchFn;
+
/// The salt to mix into all hashes used as keys for serialized data.
List<int> _salt;
@@ -77,12 +80,13 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
this._options, this._uriTranslator, this._entryPoint,
{WatchUsedFilesFn watch})
: _logger = _options.logger,
- _byteStore = _options.byteStore {
+ _byteStore = _options.byteStore,
+ _watchFn = watch {
_computeSalt();
Future<Null> onFileAdded(Uri uri) {
- if (watch != null) {
- return watch(uri, true);
+ if (_watchFn != null) {
+ return _watchFn(uri, true);
}
return new Future.value();
}
@@ -314,7 +318,12 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
}
// The file graph might have changed, perform GC.
- _fsState.gc(_entryPoint);
+ var removedFiles = _fsState.gc(_entryPoint);
+ if (removedFiles.isNotEmpty && _watchFn != null) {
+ for (var removedFile in removedFiles) {
+ await _watchFn(removedFile.fileUri, false);
+ }
+ }
});
}
« no previous file with comments | « pkg/front_end/lib/src/incremental/file_state.dart ('k') | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698