| 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 analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/analysis_logger.dart'; | 10 import 'package:analysis_server/src/analysis_logger.dart'; |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 if (!performOperationPending) { | 640 if (!performOperationPending) { |
| 641 _schedulePerformOperation(); | 641 _schedulePerformOperation(); |
| 642 } | 642 } |
| 643 } | 643 } |
| 644 | 644 |
| 645 /** | 645 /** |
| 646 * Schedules analysis of the given context. | 646 * Schedules analysis of the given context. |
| 647 */ | 647 */ |
| 648 void schedulePerformAnalysisOperation(AnalysisContext context) { | 648 void schedulePerformAnalysisOperation(AnalysisContext context) { |
| 649 _onAnalysisStartedController.add(context); | 649 _onAnalysisStartedController.add(context); |
| 650 bool isPriority = _isPriorityContext(context); | 650 scheduleOperation(new PerformAnalysisOperation(context, false)); |
| 651 scheduleOperation(new PerformAnalysisOperation(context, isPriority, false)); | |
| 652 } | 651 } |
| 653 | 652 |
| 654 /** | 653 /** |
| 655 * This method is called when analysis of the given [AnalysisContext] is | 654 * This method is called when analysis of the given [AnalysisContext] is |
| 656 * done. | 655 * done. |
| 657 */ | 656 */ |
| 658 void sendContextAnalysisDoneNotifications(AnalysisContext context, | 657 void sendContextAnalysisDoneNotifications(AnalysisContext context, |
| 659 AnalysisDoneReason reason) { | 658 AnalysisDoneReason reason) { |
| 660 Completer<AnalysisDoneReason> completer = | 659 Completer<AnalysisDoneReason> completer = |
| 661 contextAnalysisDoneCompleters.remove(context); | 660 contextAnalysisDoneCompleters.remove(context); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 throw new RequestFailure( | 823 throw new RequestFailure( |
| 825 new Response.unanalyzedPriorityFiles(requestId, buffer.toString())); | 824 new Response.unanalyzedPriorityFiles(requestId, buffer.toString())); |
| 826 } | 825 } |
| 827 folderMap.forEach((Folder folder, AnalysisContext context) { | 826 folderMap.forEach((Folder folder, AnalysisContext context) { |
| 828 List<Source> sourceList = sourceMap[context]; | 827 List<Source> sourceList = sourceMap[context]; |
| 829 if (sourceList == null) { | 828 if (sourceList == null) { |
| 830 sourceList = Source.EMPTY_ARRAY; | 829 sourceList = Source.EMPTY_ARRAY; |
| 831 } | 830 } |
| 832 context.analysisPriorityOrder = sourceList; | 831 context.analysisPriorityOrder = sourceList; |
| 833 }); | 832 }); |
| 833 operationQueue.reschedule(); |
| 834 Source firstSource = files.length > 0 ? getSource(files[0]) : null; | 834 Source firstSource = files.length > 0 ? getSource(files[0]) : null; |
| 835 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource)); | 835 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource)); |
| 836 } | 836 } |
| 837 | 837 |
| 838 /** | 838 /** |
| 839 * Returns `true` if errors should be reported for [file] with the given | 839 * Returns `true` if errors should be reported for [file] with the given |
| 840 * absolute path. | 840 * absolute path. |
| 841 */ | 841 */ |
| 842 bool shouldSendErrorsNotificationFor(String file) { | 842 bool shouldSendErrorsNotificationFor(String file) { |
| 843 return !_noErrorNotification && | 843 return !_noErrorNotification && |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 // | 922 // |
| 923 // Update the defaults used to create new contexts. | 923 // Update the defaults used to create new contexts. |
| 924 // | 924 // |
| 925 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions; | 925 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions; |
| 926 optionUpdaters.forEach((OptionUpdater optionUpdater) { | 926 optionUpdaters.forEach((OptionUpdater optionUpdater) { |
| 927 optionUpdater(options); | 927 optionUpdater(options); |
| 928 }); | 928 }); |
| 929 } | 929 } |
| 930 | 930 |
| 931 /** | 931 /** |
| 932 * Returns `true` if the given [AnalysisContext] is a priority one. | |
| 933 */ | |
| 934 bool _isPriorityContext(AnalysisContext context) { | |
| 935 // TODO(scheglov) implement support for priority sources/contexts | |
| 936 return false; | |
| 937 } | |
| 938 | |
| 939 /** | |
| 940 * Schedules [performOperation] exection. | 932 * Schedules [performOperation] exection. |
| 941 */ | 933 */ |
| 942 void _schedulePerformOperation() { | 934 void _schedulePerformOperation() { |
| 943 assert(!performOperationPending); | 935 assert(!performOperationPending); |
| 944 new Future(performOperation); | 936 new Future(performOperation); |
| 945 performOperationPending = true; | 937 performOperationPending = true; |
| 946 } | 938 } |
| 947 } | 939 } |
| 948 | 940 |
| 949 | 941 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 * [packageUriResolver]. | 1076 * [packageUriResolver]. |
| 1085 */ | 1077 */ |
| 1086 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { | 1078 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { |
| 1087 List<UriResolver> resolvers = <UriResolver>[ | 1079 List<UriResolver> resolvers = <UriResolver>[ |
| 1088 new DartUriResolver(analysisServer.defaultSdk), | 1080 new DartUriResolver(analysisServer.defaultSdk), |
| 1089 new ResourceUriResolver(resourceProvider), | 1081 new ResourceUriResolver(resourceProvider), |
| 1090 packageUriResolver]; | 1082 packageUriResolver]; |
| 1091 return new SourceFactory(resolvers); | 1083 return new SourceFactory(resolvers); |
| 1092 } | 1084 } |
| 1093 } | 1085 } |
| OLD | NEW |