OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.generated.engine; | 5 library analyzer.src.generated.engine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 */ | 622 */ |
623 void setConfigurationData(ResultDescriptor key, Object data); | 623 void setConfigurationData(ResultDescriptor key, Object data); |
624 | 624 |
625 /** | 625 /** |
626 * Set the contents of the given [source] to the given [contents] and mark the | 626 * Set the contents of the given [source] to the given [contents] and mark the |
627 * source as having changed. This has the effect of overriding the default | 627 * source as having changed. This has the effect of overriding the default |
628 * contents of the source. If the contents are `null` the override is removed | 628 * contents of the source. If the contents are `null` the override is removed |
629 * so that the default contents will be returned. | 629 * so that the default contents will be returned. |
630 */ | 630 */ |
631 void setContents(Source source, String contents); | 631 void setContents(Source source, String contents); |
632 | |
633 /** | |
634 * Check the cache for any invalid entries (entries whose modification time | |
635 * does not match the modification time of the source associated with the | |
636 * entry). Invalid entries will be marked as invalid so that the source will | |
637 * be re-analyzed. Return `true` if at least one entry was invalid. | |
638 */ | |
639 bool validateCacheConsistency(); | |
640 } | 632 } |
641 | 633 |
642 /** | 634 /** |
643 * A representation of changes to the types of analysis that should be | 635 * A representation of changes to the types of analysis that should be |
644 * performed. | 636 * performed. |
645 */ | 637 */ |
646 class AnalysisDelta { | 638 class AnalysisDelta { |
647 /** | 639 /** |
648 * A mapping from source to what type of analysis should be performed on that | 640 * A mapping from source to what type of analysis should be performed on that |
649 * source. | 641 * source. |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 | 1557 |
1566 /** | 1558 /** |
1567 * Number of sources which were deleted, but the context was not notified | 1559 * Number of sources which were deleted, but the context was not notified |
1568 * about it, so this fact was detected only during cache consistency | 1560 * about it, so this fact was detected only during cache consistency |
1569 * validation. | 1561 * validation. |
1570 */ | 1562 */ |
1571 int numOfDeleted = 0; | 1563 int numOfDeleted = 0; |
1572 } | 1564 } |
1573 | 1565 |
1574 /** | 1566 /** |
| 1567 * Interface for cache consistency validation in an [InternalAnalysisContext]. |
| 1568 */ |
| 1569 abstract class CacheConsistencyValidator { |
| 1570 /** |
| 1571 * Return sources for which the contexts needs to know modification times. |
| 1572 */ |
| 1573 List<Source> getSourcesToComputeModificationTimes(); |
| 1574 |
| 1575 /** |
| 1576 * Notify the validator that modification [times] were computed for [sources]. |
| 1577 * If a source does not exist, its modification time is `-1`. |
| 1578 * |
| 1579 * It's up to the validator and the context how to use this information, |
| 1580 * the list of sources the context has might have been changed since the |
| 1581 * previous invocation of [getSourcesToComputeModificationTimes]. |
| 1582 * |
| 1583 * Check the cache for any invalid entries (entries whose modification time |
| 1584 * does not match the modification time of the source associated with the |
| 1585 * entry). Invalid entries will be marked as invalid so that the source will |
| 1586 * be re-analyzed. Return `true` if at least one entry was invalid. |
| 1587 */ |
| 1588 bool sourceModificationTimesComputed(List<Source> sources, List<int> times); |
| 1589 } |
| 1590 |
| 1591 /** |
1575 * The possible states of cached data. | 1592 * The possible states of cached data. |
1576 */ | 1593 */ |
1577 class CacheState extends Enum<CacheState> { | 1594 class CacheState extends Enum<CacheState> { |
1578 /** | 1595 /** |
1579 * The data is not in the cache and the last time an attempt was made to | 1596 * The data is not in the cache and the last time an attempt was made to |
1580 * compute the data an exception occurred, making it pointless to attempt to | 1597 * compute the data an exception occurred, making it pointless to attempt to |
1581 * compute the data again. | 1598 * compute the data again. |
1582 * | 1599 * |
1583 * Valid Transitions: | 1600 * Valid Transitions: |
1584 * * [INVALID] if a source was modified that might cause the data to be | 1601 * * [INVALID] if a source was modified that might cause the data to be |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 */ | 2066 */ |
2050 ResultProvider resultProvider; | 2067 ResultProvider resultProvider; |
2051 | 2068 |
2052 /** | 2069 /** |
2053 * A table mapping the sources known to the context to the information known | 2070 * A table mapping the sources known to the context to the information known |
2054 * about the source. | 2071 * about the source. |
2055 */ | 2072 */ |
2056 AnalysisCache get analysisCache; | 2073 AnalysisCache get analysisCache; |
2057 | 2074 |
2058 /** | 2075 /** |
| 2076 * The cache consistency validator for this context. |
| 2077 */ |
| 2078 CacheConsistencyValidator get cacheConsistencyValidator; |
| 2079 |
| 2080 /** |
2059 * Allow the client to supply its own content cache. This will take the | 2081 * Allow the client to supply its own content cache. This will take the |
2060 * place of the content cache created by default, allowing clients to share | 2082 * place of the content cache created by default, allowing clients to share |
2061 * the content cache between contexts. | 2083 * the content cache between contexts. |
2062 */ | 2084 */ |
2063 set contentCache(ContentCache value); | 2085 set contentCache(ContentCache value); |
2064 | 2086 |
2065 /** | 2087 /** |
2066 * Get the [EmbedderYamlLocator] for this context. | 2088 * Get the [EmbedderYamlLocator] for this context. |
2067 */ | 2089 */ |
2068 @deprecated | 2090 @deprecated |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 * The data that was created from the source. | 2713 * The data that was created from the source. |
2692 */ | 2714 */ |
2693 final E data; | 2715 final E data; |
2694 | 2716 |
2695 /** | 2717 /** |
2696 * Initialize a newly created holder to associate the given [data] with the | 2718 * Initialize a newly created holder to associate the given [data] with the |
2697 * given [modificationTime]. | 2719 * given [modificationTime]. |
2698 */ | 2720 */ |
2699 TimestampedData(this.modificationTime, this.data); | 2721 TimestampedData(this.modificationTime, this.data); |
2700 } | 2722 } |
OLD | NEW |