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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 807993002: Ensure that AnalysisContext futures are completed when context disposed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle case of computeAsync called after dispose Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 } 1774 }
1775 return new AnalysisCache( 1775 return new AnalysisCache(
1776 <CachePartition>[ 1776 <CachePartition>[
1777 AnalysisEngine.instance.partitionManager.forSdk(sdk), 1777 AnalysisEngine.instance.partitionManager.forSdk(sdk),
1778 _privatePartition]); 1778 _privatePartition]);
1779 } 1779 }
1780 1780
1781 @override 1781 @override
1782 void dispose() { 1782 void dispose() {
1783 _disposed = true; 1783 _disposed = true;
1784 for (List<PendingFuture> pendingFutures in _pendingFutureSources.values) {
1785 for (PendingFuture pendingFuture in pendingFutures) {
1786 pendingFuture.forciblyComplete();
1787 }
1788 }
1789 _pendingFutureSources.clear();
1784 } 1790 }
1785 1791
1786 @override 1792 @override
1787 bool exists(Source source) { 1793 bool exists(Source source) {
1788 if (source == null) { 1794 if (source == null) {
1789 return false; 1795 return false;
1790 } 1796 }
1791 if (_contentCache.getContents(source) != null) { 1797 if (_contentCache.getContents(source) != null) {
1792 return true; 1798 return true;
1793 } 1799 }
(...skipping 12553 matching lines...) Expand 10 before | Expand all | Expand 10 after
14347 * If the [computeValue] still returns null after there is no further 14353 * If the [computeValue] still returns null after there is no further
14348 * analysis to be done for [source], then the future will be completed with 14354 * analysis to be done for [source], then the future will be completed with
14349 * the error AnalysisNotScheduledError. 14355 * the error AnalysisNotScheduledError.
14350 * 14356 *
14351 * Since [computeValue] will be called while the state of analysis is being 14357 * Since [computeValue] will be called while the state of analysis is being
14352 * updated, it should be free of side effects so that it doesn't cause 14358 * updated, it should be free of side effects so that it doesn't cause
14353 * reentrant changes to the analysis state. 14359 * reentrant changes to the analysis state.
14354 */ 14360 */
14355 CancelableFuture<T> computeAsync(Source source, T 14361 CancelableFuture<T> computeAsync(Source source, T
14356 computeValue(SourceEntry sourceEntry)) { 14362 computeValue(SourceEntry sourceEntry)) {
14363 if (_context.isDisposed) {
14364 // No further analysis is expected, so return a future that completes
14365 // immediately with AnalysisNotScheduledError.
14366 return new CancelableFuture.error(new AnalysisNotScheduledError());
14367 }
14357 SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source); 14368 SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source);
14358 if (sourceEntry == null) { 14369 if (sourceEntry == null) {
14359 return new CancelableFuture.error(new AnalysisNotScheduledError()); 14370 return new CancelableFuture.error(new AnalysisNotScheduledError());
14360 } 14371 }
14361 PendingFuture pendingFuture = 14372 PendingFuture pendingFuture =
14362 new PendingFuture<T>(_context, source, computeValue); 14373 new PendingFuture<T>(_context, source, computeValue);
14363 if (!pendingFuture.evaluate(sourceEntry)) { 14374 if (!pendingFuture.evaluate(sourceEntry)) {
14364 _context._pendingFutureSources.putIfAbsent( 14375 _context._pendingFutureSources.putIfAbsent(
14365 source, 14376 source,
14366 () => <PendingFuture>[]).add(pendingFuture); 14377 () => <PendingFuture>[]).add(pendingFuture);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
14414 14425
14415 @override 14426 @override
14416 Object visitPolymerTagDartElement(PolymerTagDartElement element) { 14427 Object visitPolymerTagDartElement(PolymerTagDartElement element) {
14417 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { 14428 if (element.name == PolymerHtmlUnitBuilder_this._elementName) {
14418 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( 14429 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError(
14419 element as PolymerTagDartElementImpl); 14430 element as PolymerTagDartElementImpl);
14420 } 14431 }
14421 return null; 14432 return null;
14422 } 14433 }
14423 } 14434 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698