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

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

Issue 916973002: More complete state transition data (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | 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 5c48c322f49cf75d71ec8ff3e472b5b532042be4..13ea09d8940712687a38a1ecdf84567958dfd261 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -10939,10 +10939,7 @@ class ResolutionState {
void setValue(DataDescriptor /*<V>*/ descriptor, dynamic /*V*/ value) {
CachedResult result =
resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor));
- if (result.state == CacheState.FLUSHED) {
- int count = SourceEntry.unflushedCountMap[descriptor];
- SourceEntry.unflushedCountMap[descriptor] = count == null ? 1 : count + 1;
- }
+ SourceEntry.countTransition(descriptor, result);
result.state = CacheState.VALID;
result.value = value == null ? descriptor.defaultValue : value;
}
@@ -11625,10 +11622,10 @@ abstract class SourceEntry {
/**
* A table mapping data descriptors to a count of the number of times a value
- * of that kind was flushed and then re-created.
+ * was set when in a given state.
*/
- static final Map<DataDescriptor, int> unflushedCountMap =
- new HashMap<DataDescriptor, int>();
+ static final Map<DataDescriptor, Map<CacheState, int>> transitionMap =
+ new HashMap<DataDescriptor, Map<CacheState, int>>();
/**
* The most recent time at which the state of the source matched the state
@@ -11820,14 +11817,23 @@ abstract class SourceEntry {
_validateStateChange(descriptor, CacheState.VALID);
CachedResult result =
resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor));
- if (result.state == CacheState.FLUSHED) {
- int count = unflushedCountMap[descriptor];
- unflushedCountMap[descriptor] = count == null ? 1 : count + 1;
- }
+ countTransition(descriptor, result);
result.state = CacheState.VALID;
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();
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698