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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 924563002: Flush entries for unreferenced sources (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up Created 5 years, 10 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/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 67a7a2309d2abe3fb053a2c1faf7df135e2b0609..c76cef70986778c89d2a3850d42a1214884c017b 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -5174,6 +5174,14 @@ class AnalysisContextImpl implements InternalAnalysisContext {
for (int i = 0; i < count; i++) {
_sourceChanged(changedSources[i]);
}
+ int removalCount = 0;
+ for (Source source in missingSources) {
+ if (getLibrariesContaining(source).isEmpty &&
+ getLibrariesDependingOn(source).isEmpty) {
+ _cache.remove(source);
+ removalCount++;
+ }
+ }
int consistencyCheckEnd = JavaSystem.nanoTime();
if (changedSources.length > 0 || missingSources.length > 0) {
StringBuffer buffer = new StringBuffer();
@@ -5185,7 +5193,9 @@ class AnalysisContextImpl implements InternalAnalysisContext {
buffer.writeln(" inconsistent entries");
buffer.write(" ");
buffer.write(missingSources.length);
- buffer.writeln(" missing sources");
+ buffer.write(" missing sources (");
+ buffer.write(removalCount);
+ buffer.writeln(" removed");
for (Source source in missingSources) {
buffer.write(" ");
buffer.writeln(source.fullName);
@@ -11844,18 +11854,6 @@ abstract class SourceEntry {
result.value = value == null ? descriptor.defaultValue : value;
}
- /**
- * Increment the count of the number of times that data represented by the
- * given [descriptor] was transitioned from the current state (as found in the
- * given [result] to a valid state.
- */
- static void countTransition(DataDescriptor descriptor, CachedResult result) {
- Map<CacheState, int> countMap =
- transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int>());
- int count = countMap[result.state];
- countMap[result.state] = count == null ? 1 : count + 1;
- }
-
@override
String toString() {
StringBuffer buffer = new StringBuffer();
@@ -12006,6 +12004,18 @@ abstract class SourceEntry {
buffer.write(" = ");
buffer.write(result == null ? CacheState.INVALID : result.state);
}
+
+ /**
+ * Increment the count of the number of times that data represented by the
+ * given [descriptor] was transitioned from the current state (as found in the
+ * given [result] to a valid state.
+ */
+ static void countTransition(DataDescriptor descriptor, CachedResult result) {
+ Map<CacheState, int> countMap =
+ transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int>());
+ int count = countMap[result.state];
+ countMap[result.state] = count == null ? 1 : count + 1;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698