| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 delta = null; | 666 delta = null; |
| 667 } | 667 } |
| 668 if (deltaResult == DeltaResult.INVALIDATE_KEEP_DEPENDENCIES) { | 668 if (deltaResult == DeltaResult.INVALIDATE_KEEP_DEPENDENCIES) { |
| 669 thisData.value = descriptor.defaultValue; | 669 thisData.value = descriptor.defaultValue; |
| 670 thisData.state = CacheState.INVALID; | 670 thisData.state = CacheState.INVALID; |
| 671 } else if (deltaResult == null || | 671 } else if (deltaResult == null || |
| 672 deltaResult == DeltaResult.INVALIDATE || | 672 deltaResult == DeltaResult.INVALIDATE || |
| 673 deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { | 673 deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { |
| 674 _resultMap.remove(descriptor); | 674 _resultMap.remove(descriptor); |
| 675 // Stop depending on other results. | 675 // Stop depending on other results. |
| 676 if (deltaResult != DeltaResult.KEEP_CONTINUE) { | 676 { |
| 677 TargetedResult thisResult = new TargetedResult(target, descriptor); | 677 TargetedResult thisResult = new TargetedResult(target, descriptor); |
| 678 List<AnalysisCache> caches = _partition.containingCaches; | 678 List<AnalysisCache> caches = _partition.containingCaches; |
| 679 int cacheLength = caches.length; | 679 int cacheLength = caches.length; |
| 680 List<TargetedResult> results = thisData.dependedOnResults; | 680 List<TargetedResult> results = thisData.dependedOnResults; |
| 681 int resultLength = results.length; | 681 int resultLength = results.length; |
| 682 for (int i = 0; i < resultLength; i++) { | 682 for (int i = 0; i < resultLength; i++) { |
| 683 TargetedResult dependedOnResult = results[i]; | 683 TargetedResult dependedOnResult = results[i]; |
| 684 for (int j = 0; j < cacheLength; j++) { | 684 for (int j = 0; j < cacheLength; j++) { |
| 685 AnalysisCache cache = caches[j]; | 685 AnalysisCache cache = caches[j]; |
| 686 CacheEntry entry = cache.get(dependedOnResult.target); | 686 CacheEntry entry = cache.get(dependedOnResult.target); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 707 _invalidateDependentResults(id, thisData, delta, level + 1); | 707 _invalidateDependentResults(id, thisData, delta, level + 1); |
| 708 // If empty and not explicitly added, remove the entry altogether. | 708 // If empty and not explicitly added, remove the entry altogether. |
| 709 if (_resultMap.isEmpty && !explicitlyAdded) { | 709 if (_resultMap.isEmpty && !explicitlyAdded) { |
| 710 CacheEntry entry = _partition.entryMap.remove(target); | 710 CacheEntry entry = _partition.entryMap.remove(target); |
| 711 if (entry != null) { | 711 if (entry != null) { |
| 712 entry.dispose(); | 712 entry.dispose(); |
| 713 } | 713 } |
| 714 _partition._removeIfSource(target); | 714 _partition._removeIfSource(target); |
| 715 } | 715 } |
| 716 // Notify controller. | 716 // Notify controller. |
| 717 _partition.onResultInvalidated | 717 if (deltaResult != DeltaResult.KEEP_CONTINUE) { |
| 718 .add(new InvalidatedResult(this, descriptor, thisData.value)); | 718 _partition.onResultInvalidated |
| 719 .add(new InvalidatedResult(this, descriptor, thisData.value)); |
| 720 } |
| 719 } | 721 } |
| 720 | 722 |
| 721 /** | 723 /** |
| 722 * Invalidates all the results of this entry, with propagation. | 724 * Invalidates all the results of this entry, with propagation. |
| 723 */ | 725 */ |
| 724 void _invalidateAll() { | 726 void _invalidateAll() { |
| 725 List<ResultDescriptor> results = _resultMap.keys.toList(); | 727 List<ResultDescriptor> results = _resultMap.keys.toList(); |
| 726 int length = results.length; | 728 int length = results.length; |
| 727 for (int i = 0; i < length; i++) { | 729 for (int i = 0; i < length; i++) { |
| 728 ResultDescriptor result = results[i]; | 730 ResultDescriptor result = results[i]; |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 void resultAccessed(TargetedResult result) {} | 1503 void resultAccessed(TargetedResult result) {} |
| 1502 | 1504 |
| 1503 @override | 1505 @override |
| 1504 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1506 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1505 return TargetedResult.EMPTY_LIST; | 1507 return TargetedResult.EMPTY_LIST; |
| 1506 } | 1508 } |
| 1507 | 1509 |
| 1508 @override | 1510 @override |
| 1509 void targetRemoved(AnalysisTarget target) {} | 1511 void targetRemoved(AnalysisTarget target) {} |
| 1510 } | 1512 } |
| OLD | NEW |