| 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:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 addOperation(operation); | 249 addOperation(operation); |
| 250 if (wasEmpty) { | 250 if (wasEmpty) { |
| 251 _schedulePerformOperation(); | 251 _schedulePerformOperation(); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 /** | 255 /** |
| 256 * Schedules analysis of the given context. | 256 * Schedules analysis of the given context. |
| 257 */ | 257 */ |
| 258 void schedulePerformAnalysisOperation(AnalysisContext context) { | 258 void schedulePerformAnalysisOperation(AnalysisContext context) { |
| 259 _notifyAnalysisStarted(context); |
| 259 scheduleOperation(new PerformAnalysisOperation(context, false)); | 260 scheduleOperation(new PerformAnalysisOperation(context, false)); |
| 260 } | 261 } |
| 261 | 262 |
| 262 /** | 263 /** |
| 263 * Send the given [notification] to the client. | 264 * Send the given [notification] to the client. |
| 264 */ | 265 */ |
| 265 void sendNotification(Notification notification) { | 266 void sendNotification(Notification notification) { |
| 266 channel.sendNotification(notification); | 267 channel.sendNotification(notification); |
| 267 } | 268 } |
| 268 | 269 |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 } | 897 } |
| 897 | 898 |
| 898 /** | 899 /** |
| 899 * Return `true` if all operations have been performed in this [AnalysisServer
]. | 900 * Return `true` if all operations have been performed in this [AnalysisServer
]. |
| 900 */ | 901 */ |
| 901 bool test_areOperationsFinished() { | 902 bool test_areOperationsFinished() { |
| 902 return operationQueue.isEmpty; | 903 return operationQueue.isEmpty; |
| 903 } | 904 } |
| 904 | 905 |
| 905 /** | 906 /** |
| 907 * Notify all listeners that analysis of [context] is started. |
| 908 */ |
| 909 void _notifyAnalysisStarted(AnalysisContext context) { |
| 910 listeners.forEach((AnalysisServerListener listener) { |
| 911 listener.analysisStarted(context); |
| 912 }); |
| 913 } |
| 914 |
| 915 /** |
| 906 * Notify all listeners that analysis is complete. | 916 * Notify all listeners that analysis is complete. |
| 907 */ | 917 */ |
| 908 void _notifyAnalysisComplete() { | 918 void _notifyAnalysisComplete() { |
| 909 listeners.forEach((AnalysisServerListener listener) { | 919 listeners.forEach((AnalysisServerListener listener) { |
| 910 listener.analysisComplete(); | 920 listener.analysisComplete(); |
| 911 }); | 921 }); |
| 912 } | 922 } |
| 913 | 923 |
| 914 /** | 924 /** |
| 915 * Schedules [performOperation] exection. | 925 * Schedules [performOperation] exection. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 946 } | 956 } |
| 947 | 957 |
| 948 /** | 958 /** |
| 949 * An object that is listening for lifecycle events from an analysis server. | 959 * An object that is listening for lifecycle events from an analysis server. |
| 950 */ | 960 */ |
| 951 abstract class AnalysisServerListener { | 961 abstract class AnalysisServerListener { |
| 952 /** | 962 /** |
| 953 * Analysis is complete. | 963 * Analysis is complete. |
| 954 */ | 964 */ |
| 955 void analysisComplete(); | 965 void analysisComplete(); |
| 966 |
| 967 /** |
| 968 * Analysis is started. |
| 969 */ |
| 970 void analysisStarted(AnalysisContext context); |
| 956 } | 971 } |
| 957 | 972 |
| 958 typedef void OptionUpdater(AnalysisOptionsImpl options); | 973 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| OLD | NEW |