| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.context.cache; | 5 library analyzer.src.context.cache; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| 11 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; | 11 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; |
| 12 import 'package:analyzer/src/generated/html.dart'; | 12 import 'package:analyzer/src/generated/html.dart'; |
| 13 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/generated/utilities_collection.dart'; | 15 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 15 import 'package:analyzer/task/model.dart'; | 16 import 'package:analyzer/task/model.dart'; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * An LRU cache of results produced by analysis. | 19 * An LRU cache of results produced by analysis. |
| 19 */ | 20 */ |
| 20 class AnalysisCache { | 21 class AnalysisCache { |
| 21 /** | 22 /** |
| 22 * A flag used to control whether trace information should be produced when | 23 * A flag used to control whether trace information should be produced when |
| 23 * the content of the cache is modified. | 24 * the content of the cache is modified. |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 class SdkCachePartition extends CachePartition { | 783 class SdkCachePartition extends CachePartition { |
| 783 /** | 784 /** |
| 784 * Initialize a newly created cache partition, belonging to the given | 785 * Initialize a newly created cache partition, belonging to the given |
| 785 * [context]. The partition will maintain at most [maxCacheSize] AST | 786 * [context]. The partition will maintain at most [maxCacheSize] AST |
| 786 * structures in the cache. | 787 * structures in the cache. |
| 787 */ | 788 */ |
| 788 SdkCachePartition(InternalAnalysisContext context, int maxCacheSize) | 789 SdkCachePartition(InternalAnalysisContext context, int maxCacheSize) |
| 789 : super(context, maxCacheSize, DefaultRetentionPolicy.POLICY); | 790 : super(context, maxCacheSize, DefaultRetentionPolicy.POLICY); |
| 790 | 791 |
| 791 @override | 792 @override |
| 792 bool contains(AnalysisTarget target) => target.source.isInSystemLibrary; | 793 bool contains(AnalysisTarget target) { |
| 794 Source source = target.source; |
| 795 return source != null && source.isInSystemLibrary; |
| 796 } |
| 793 } | 797 } |
| 794 | 798 |
| 795 /** | 799 /** |
| 796 * A cache partition that contains all targets not contained in other partitions
. | 800 * A cache partition that contains all targets not contained in other partitions
. |
| 797 */ | 801 */ |
| 798 class UniversalCachePartition extends CachePartition { | 802 class UniversalCachePartition extends CachePartition { |
| 799 /** | 803 /** |
| 800 * Initialize a newly created cache partition, belonging to the given | 804 * Initialize a newly created cache partition, belonging to the given |
| 801 * [context]. The partition will maintain at most [maxCacheSize] AST | 805 * [context]. The partition will maintain at most [maxCacheSize] AST |
| 802 * structures in the cache, using the [retentionPolicy] to determine which | 806 * structures in the cache, using the [retentionPolicy] to determine which |
| 803 * AST structures to flush. | 807 * AST structures to flush. |
| 804 */ | 808 */ |
| 805 UniversalCachePartition(InternalAnalysisContext context, int maxCacheSize, | 809 UniversalCachePartition(InternalAnalysisContext context, int maxCacheSize, |
| 806 CacheRetentionPolicy retentionPolicy) | 810 CacheRetentionPolicy retentionPolicy) |
| 807 : super(context, maxCacheSize, retentionPolicy); | 811 : super(context, maxCacheSize, retentionPolicy); |
| 808 | 812 |
| 809 @override | 813 @override |
| 810 bool contains(AnalysisTarget target) => true; | 814 bool contains(AnalysisTarget target) => true; |
| 811 } | 815 } |
| OLD | NEW |