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

Unified Diff: pkg/front_end/lib/src/incremental/file_state.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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/incremental_kernel_generator_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/incremental/file_state.dart
diff --git a/pkg/front_end/lib/src/incremental/file_state.dart b/pkg/front_end/lib/src/incremental/file_state.dart
index 34a92338822e7aa2eb441c0653b660f9e45fa9d3..61400d6f12b0f816c885a60b7004f6b9377682fa 100644
--- a/pkg/front_end/lib/src/incremental/file_state.dart
+++ b/pkg/front_end/lib/src/incremental/file_state.dart
@@ -314,7 +314,8 @@ class FileSystemState {
Iterable<Uri> get fileUris => _fileUriToFile.keys;
/// Perform mark and sweep garbage collection of [FileState]s.
- void gc(Uri entryPoint) {
+ /// Return [FileState]s that became garbage.
+ List<FileState> gc(Uri entryPoint) {
void mark(FileState file) {
if (!file._gcMarked) {
file._gcMarked = true;
@@ -323,16 +324,18 @@ class FileSystemState {
}
var file = _uriToFile[entryPoint];
- if (file == null) return;
+ if (file == null) return const [];
mark(file);
+ var filesToRemove = <FileState>[];
var urisToRemove = new Set<Uri>();
var fileUrisToRemove = new Set<Uri>();
for (var file in _uriToFile.values) {
if (file._gcMarked) {
file._gcMarked = false;
} else {
+ filesToRemove.add(file);
urisToRemove.add(file.uri);
fileUrisToRemove.add(file.fileUri);
}
@@ -340,6 +343,7 @@ class FileSystemState {
urisToRemove.forEach(_uriToFile.remove);
fileUrisToRemove.forEach(_fileUriToFile.remove);
+ return filesToRemove;
}
/// Return the [FileState] for the given [absoluteUri], or `null` if the
« no previous file with comments | « no previous file | pkg/front_end/lib/src/incremental_kernel_generator_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698