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

Side by Side Diff: pkg/analyzer/lib/src/task/options_work_manager.dart

Issue 2151373002: Share LibrarySpecificUnits when possible (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Clean-up Created 4 years, 5 months 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
OLDNEW
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.task.options_work_manager; 5 library analyzer.src.task.options_work_manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
(...skipping 19 matching lines...) Expand all
30 OptionsWorkManager(this.context) { 30 OptionsWorkManager(this.context) {
31 analysisCache.onResultInvalidated.listen(onResultInvalidated); 31 analysisCache.onResultInvalidated.listen(onResultInvalidated);
32 } 32 }
33 33
34 /// Returns the correctly typed result of `context.analysisCache`. 34 /// Returns the correctly typed result of `context.analysisCache`.
35 AnalysisCache get analysisCache => context.analysisCache; 35 AnalysisCache get analysisCache => context.analysisCache;
36 36
37 /// Specifies that the client wants the given [result] of the given [target] 37 /// Specifies that the client wants the given [result] of the given [target]
38 /// to be computed with priority. 38 /// to be computed with priority.
39 void addPriorityResult(AnalysisTarget target, ResultDescriptor result) { 39 void addPriorityResult(AnalysisTarget target, ResultDescriptor result) {
40 priorityResultQueue.add(new TargetedResult(target, result)); 40 priorityResultQueue
41 .add(new TargetedResult(context.canonicalizeTarget(target), result));
41 } 42 }
42 43
43 @override 44 @override
44 void applyChange(List<Source> addedSources, List<Source> changedSources, 45 void applyChange(List<Source> addedSources, List<Source> changedSources,
45 List<Source> removedSources) { 46 List<Source> removedSources) {
46 addedSources = addedSources.where(_isOptionsSource).toList(); 47 addedSources = addedSources.where(_isOptionsSource).toList();
47 changedSources = changedSources.where(_isOptionsSource).toList(); 48 changedSources = changedSources.where(_isOptionsSource).toList();
48 removedSources = removedSources.where(_isOptionsSource).toList(); 49 removedSources = removedSources.where(_isOptionsSource).toList();
49 // source queue 50 // source queue
50 sourceQueue.addAll(addedSources); 51 sourceQueue.addAll(addedSources);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) { 161 bool _needsComputing(AnalysisTarget target, ResultDescriptor result) {
161 CacheState state = analysisCache.getState(target, result); 162 CacheState state = analysisCache.getState(target, result);
162 return state != CacheState.VALID && state != CacheState.ERROR; 163 return state != CacheState.VALID && state != CacheState.ERROR;
163 } 164 }
164 165
165 /// Return `true` if the given target is an analysis options source. 166 /// Return `true` if the given target is an analysis options source.
166 static bool _isOptionsSource(AnalysisTarget target) => 167 static bool _isOptionsSource(AnalysisTarget target) =>
167 target is Source && 168 target is Source &&
168 AnalysisEngine.isAnalysisOptionsFileName(target.fullName); 169 AnalysisEngine.isAnalysisOptionsFileName(target.fullName);
169 } 170 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/html_work_manager.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698