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

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

Issue 1133513003: Cache flushing implementation for the task model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index debb32e7973178d6b30dd144d75f0a91299dff27..1e570d6d0d786864a1cac216fcdffb15f6397b52 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -181,9 +181,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
* Initialize a newly created analysis context.
*/
AnalysisContextImpl() {
- _privatePartition = new cache.UniversalCachePartition(this,
- AnalysisOptionsImpl.DEFAULT_CACHE_SIZE,
- new ContextRetentionPolicy(this));
+ _privatePartition = new cache.UniversalCachePartition(this);
_cache = createCacheFromSourceFactory(null);
_taskManager = AnalysisEngine.instance.taskManager;
_driver = new AnalysisDriver(_taskManager, this);
@@ -210,7 +208,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
int cacheSize = options.cacheSize;
if (this._options.cacheSize != cacheSize) {
this._options.cacheSize = cacheSize;
- _privatePartition.maxCacheSize = cacheSize;
}
this._options.analyzeFunctionBodiesPredicate =
options.analyzeFunctionBodiesPredicate;
@@ -1936,57 +1933,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
- * A retention policy used by an analysis context.
- */
-class ContextRetentionPolicy implements cache.CacheRetentionPolicy {
- /**
- * The context associated with this policy.
- */
- final AnalysisContextImpl context;
-
- /**
- * Initialize a newly created policy to be associated with the given
- * [context].
- */
- ContextRetentionPolicy(this.context);
-
- @override
- RetentionPriority getAstPriority(
- AnalysisTarget target, cache.CacheEntry entry) {
- int priorityCount = context._priorityOrder.length;
- for (int i = 0; i < priorityCount; i++) {
- if (target == context._priorityOrder[i]) {
- return RetentionPriority.HIGH;
- }
- }
- if (_astIsNeeded(entry)) {
- return RetentionPriority.MEDIUM;
- }
- return RetentionPriority.LOW;
- }
-
- bool _astIsNeeded(cache.CacheEntry entry) =>
- entry.isInvalid(BUILD_FUNCTION_TYPE_ALIASES_ERRORS) ||
- entry.isInvalid(BUILD_LIBRARY_ERRORS) ||
- entry.isInvalid(CONSTRUCTORS_ERRORS) ||
- entry.isInvalid(HINTS) ||
- //entry.isInvalid(LINTS) ||
- entry.isInvalid(RESOLVE_REFERENCES_ERRORS) ||
- entry.isInvalid(RESOLVE_TYPE_NAMES_ERRORS) ||
- entry.isInvalid(VERIFY_ERRORS);
-}
-
-/**
* An object that manages the partitions that can be shared between analysis
* contexts.
*/
class PartitionManager {
/**
- * The default cache size for a Dart SDK partition.
- */
- static int _DEFAULT_SDK_CACHE_SIZE = 256;
-
- /**
* A table mapping SDK's to the partitions used for those SDK's.
*/
HashMap<DartSdk, cache.SdkCachePartition> _sdkPartitions =
@@ -2013,8 +1964,7 @@ class PartitionManager {
// Check cache for an existing partition.
cache.SdkCachePartition partition = _sdkPartitions[sdk];
if (partition == null) {
- partition =
- new cache.SdkCachePartition(sdkContext, _DEFAULT_SDK_CACHE_SIZE);
+ partition = new cache.SdkCachePartition(sdkContext);
_sdkPartitions[sdk] = partition;
}
return partition;

Powered by Google App Engine
This is Rietveld 408576698