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

Unified Diff: pkg/analyzer/lib/src/context/cache.dart

Issue 1351243003: Fix status pages when running new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Clean up Created 5 years, 3 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/analyzer/lib/src/context/cache.dart
diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
index 89a28bf0ba372099aba6f7e984acc465ce3d4414..4535ca4ce1d4cea4079b9eafa45152bce0f267f5 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -166,14 +166,17 @@ class AnalysisCache {
/**
* Return an iterator returning all of the map entries mapping targets to
- * cache entries.
+ * cache entries. If the [context] is not `null`, then only entries that are
+ * owned by the given context will be returned.
*/
- MapIterator<AnalysisTarget, CacheEntry> iterator() {
- int count = _partitions.length;
+ MapIterator<AnalysisTarget, CacheEntry> iterator(
+ {InternalAnalysisContext context: null}) {
List<Map<AnalysisTarget, CacheEntry>> maps =
- new List<Map<AnalysisTarget, CacheEntry>>(count);
- for (int i = 0; i < count; i++) {
- maps[i] = _partitions[i].map;
+ <Map<AnalysisTarget, CacheEntry>>[];
+ for (CachePartition partition in _partitions) {
+ if (context == null || partition.context == context) {
+ maps.add(partition.map);
+ }
}
return new MultipleMapIterator<AnalysisTarget, CacheEntry>(maps);
}
@@ -972,10 +975,8 @@ abstract class CachePartition {
void _addIfSource(AnalysisTarget target) {
if (target is Source) {
_sources.add(target);
- {
- String fullName = target.fullName;
- _pathToSources.putIfAbsent(fullName, () => <Source>[]).add(target);
- }
+ String fullName = target.fullName;
+ _pathToSources.putIfAbsent(fullName, () => <Source>[]).add(target);
}
}

Powered by Google App Engine
This is Rietveld 408576698