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.context; | 5 library analyzer.src.context.context; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/instrumentation/instrumentation.dart'; | 10 import 'package:analyzer/instrumentation/instrumentation.dart'; |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1765 entry.setState(CONTENT, CacheState.FLUSHED); | 1765 entry.setState(CONTENT, CacheState.FLUSHED); |
1766 try { | 1766 try { |
1767 TimestampedData<String> fileContents = getContents(source); | 1767 TimestampedData<String> fileContents = getContents(source); |
1768 if (fileContents.data == sourceContent) { | 1768 if (fileContents.data == sourceContent) { |
1769 int time = fileContents.modificationTime; | 1769 int time = fileContents.modificationTime; |
1770 for (CacheEntry entry in _entriesFor(source)) { | 1770 for (CacheEntry entry in _entriesFor(source)) { |
1771 entry.modificationTime = time; | 1771 entry.modificationTime = time; |
1772 } | 1772 } |
1773 return; | 1773 return; |
1774 } | 1774 } |
1775 } catch (e) {} | 1775 } catch (e) { |
1776 entry.modificationTime = -1; | |
Brian Wilkerson
2015/09/23 13:53:38
Does this need to set the modification stamp for a
scheglov
2015/09/23 15:11:27
In theory yes, but practically we invalidate every
| |
1777 } | |
1776 } | 1778 } |
1777 // We need to invalidate the cache. | 1779 // We need to invalidate the cache. |
1778 { | 1780 { |
1779 Object delta = null; | 1781 Object delta = null; |
1780 if (AnalysisEngine.instance.limitInvalidationInTaskModel && | 1782 if (AnalysisEngine.instance.limitInvalidationInTaskModel && |
1781 AnalysisEngine.isDartFileName(source.fullName)) { | 1783 AnalysisEngine.isDartFileName(source.fullName)) { |
1782 // TODO(scheglov) Incorrect implementation in general. | 1784 // TODO(scheglov) Incorrect implementation in general. |
1783 entry.setState(TOKEN_STREAM, CacheState.FLUSHED); | 1785 entry.setState(TOKEN_STREAM, CacheState.FLUSHED); |
1784 entry.setState(PARSED_UNIT, CacheState.FLUSHED); | 1786 entry.setState(PARSED_UNIT, CacheState.FLUSHED); |
1785 List<Source> librarySources = getLibrariesContaining(source); | 1787 List<Source> librarySources = getLibrariesContaining(source); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2110 new PendingFuture<T>(_context, target, computeValue); | 2112 new PendingFuture<T>(_context, target, computeValue); |
2111 if (!pendingFuture.evaluate(entry)) { | 2113 if (!pendingFuture.evaluate(entry)) { |
2112 _context._pendingFutureTargets | 2114 _context._pendingFutureTargets |
2113 .putIfAbsent(target, () => <PendingFuture>[]) | 2115 .putIfAbsent(target, () => <PendingFuture>[]) |
2114 .add(pendingFuture); | 2116 .add(pendingFuture); |
2115 scheduleComputation(); | 2117 scheduleComputation(); |
2116 } | 2118 } |
2117 return pendingFuture.future; | 2119 return pendingFuture.future; |
2118 } | 2120 } |
2119 } | 2121 } |
OLD | NEW |