Chromium Code Reviews| 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 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Instances of the class [AnalysisServer] implement a server that listens on a | 67 * Instances of the class [AnalysisServer] implement a server that listens on a |
| 68 * [CommunicationChannel] for analysis requests and process them. | 68 * [CommunicationChannel] for analysis requests and process them. |
| 69 */ | 69 */ |
| 70 class AnalysisServer { | 70 class AnalysisServer { |
| 71 /** | 71 /** |
| 72 * The version of the analysis server. The value should be replaced | 72 * The version of the analysis server. The value should be replaced |
| 73 * automatically during the build. | 73 * automatically during the build. |
| 74 */ | 74 */ |
| 75 static final String VERSION = '1.7.0'; | 75 static final String VERSION = '1.8.0'; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * The number of milliseconds to perform operations before inserting | 78 * The number of milliseconds to perform operations before inserting |
| 79 * a 1 millisecond delay so that the VM and dart:io can deliver content | 79 * a 1 millisecond delay so that the VM and dart:io can deliver content |
| 80 * to stdin. This should be removed once the underlying problem is fixed. | 80 * to stdin. This should be removed once the underlying problem is fixed. |
| 81 */ | 81 */ |
| 82 static int performOperationDelayFreqency = 25; | 82 static int performOperationDelayFreqency = 25; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * The channel from which requests are received and to which responses should | 85 * The channel from which requests are received and to which responses should |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 * True if there is a pending future which will execute [performOperation]. | 157 * True if there is a pending future which will execute [performOperation]. |
| 158 */ | 158 */ |
| 159 bool performOperationPending = false; | 159 bool performOperationPending = false; |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * A set of the [ServerService]s to send notifications for. | 162 * A set of the [ServerService]s to send notifications for. |
| 163 */ | 163 */ |
| 164 Set<ServerService> serverServices = new HashSet<ServerService>(); | 164 Set<ServerService> serverServices = new HashSet<ServerService>(); |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * A set of the [GeneralAnalysisService]s to send notifications for. | |
| 168 */ | |
| 169 Set<GeneralAnalysisService> generalAnalysisServices = | |
| 170 new HashSet<GeneralAnalysisService>(); | |
| 171 | |
| 172 /** | |
| 167 * A table mapping [AnalysisService]s to the file paths for which these | 173 * A table mapping [AnalysisService]s to the file paths for which these |
| 168 * notifications should be sent. | 174 * notifications should be sent. |
| 169 */ | 175 */ |
| 170 Map<AnalysisService, Set<String>> analysisServices = | 176 Map<AnalysisService, Set<String>> analysisServices = |
| 171 new HashMap<AnalysisService, Set<String>>(); | 177 new HashMap<AnalysisService, Set<String>>(); |
| 172 | 178 |
| 173 /** | 179 /** |
| 174 * A table mapping [AnalysisContext]s to the completers that should be | 180 * A table mapping [AnalysisContext]s to the completers that should be |
| 175 * completed when analysis of this context is finished. | 181 * completed when analysis of this context is finished. |
| 176 */ | 182 */ |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 } finally { | 761 } finally { |
| 756 if (_test_onOperationPerformedCompleter != null) { | 762 if (_test_onOperationPerformedCompleter != null) { |
| 757 _test_onOperationPerformedCompleter.complete(operation); | 763 _test_onOperationPerformedCompleter.complete(operation); |
| 758 _test_onOperationPerformedCompleter = null; | 764 _test_onOperationPerformedCompleter = null; |
| 759 } | 765 } |
| 760 if (!operationQueue.isEmpty) { | 766 if (!operationQueue.isEmpty) { |
| 761 ServerPerformanceStatistics.intertask.makeCurrent(); | 767 ServerPerformanceStatistics.intertask.makeCurrent(); |
| 762 _schedulePerformOperation(); | 768 _schedulePerformOperation(); |
| 763 } else { | 769 } else { |
| 764 sendStatusNotification(null); | 770 sendStatusNotification(null); |
| 771 if (generalAnalysisServices | |
|
Paul Berry
2015/07/13 21:51:13
Consider putting this before the call to sendStatu
Brian Wilkerson
2015/07/13 22:05:03
Done
| |
| 772 .contains(GeneralAnalysisService.ANALYZED_FILES)) { | |
| 773 sendAnalysisNotificationAnalyzedFiles(this); | |
| 774 } | |
| 765 if (_onAnalysisCompleteCompleter != null) { | 775 if (_onAnalysisCompleteCompleter != null) { |
| 766 _onAnalysisCompleteCompleter.complete(); | 776 _onAnalysisCompleteCompleter.complete(); |
| 767 _onAnalysisCompleteCompleter = null; | 777 _onAnalysisCompleteCompleter = null; |
| 768 } | 778 } |
| 769 ServerPerformanceStatistics.idle.makeCurrent(); | 779 ServerPerformanceStatistics.idle.makeCurrent(); |
| 770 } | 780 } |
| 771 } | 781 } |
| 772 } | 782 } |
| 773 | 783 |
| 774 /** | 784 /** |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 } | 953 } |
| 944 } | 954 } |
| 945 } | 955 } |
| 946 } | 956 } |
| 947 }); | 957 }); |
| 948 // remember new subscriptions | 958 // remember new subscriptions |
| 949 this.analysisServices = subscriptions; | 959 this.analysisServices = subscriptions; |
| 950 } | 960 } |
| 951 | 961 |
| 952 /** | 962 /** |
| 963 * Implementation for `analysis.setGeneralSubscriptions`. | |
| 964 */ | |
| 965 void setGeneralAnalysisSubscriptions( | |
| 966 List<GeneralAnalysisService> subscriptions) { | |
| 967 Set<GeneralAnalysisService> newServices = subscriptions.toSet(); | |
| 968 if (newServices.contains(GeneralAnalysisService.ANALYZED_FILES) && | |
| 969 !generalAnalysisServices | |
| 970 .contains(GeneralAnalysisService.ANALYZED_FILES) && | |
| 971 isAnalysisComplete()) { | |
| 972 sendAnalysisNotificationAnalyzedFiles(this); | |
| 973 } | |
| 974 generalAnalysisServices = newServices; | |
| 975 } | |
| 976 | |
| 977 /** | |
| 953 * Set the priority files to the given [files]. | 978 * Set the priority files to the given [files]. |
| 954 */ | 979 */ |
| 955 void setPriorityFiles(String requestId, List<String> files) { | 980 void setPriorityFiles(String requestId, List<String> files) { |
| 956 // Note: when a file is a priority file, that information needs to be | 981 // Note: when a file is a priority file, that information needs to be |
| 957 // propagated to all contexts that analyze the file, so that all contexts | 982 // propagated to all contexts that analyze the file, so that all contexts |
| 958 // will be able to do incremental resolution of the file. See | 983 // will be able to do incremental resolution of the file. See |
| 959 // dartbug.com/22209. | 984 // dartbug.com/22209. |
| 960 Map<AnalysisContext, List<Source>> sourceMap = | 985 Map<AnalysisContext, List<Source>> sourceMap = |
| 961 new HashMap<AnalysisContext, List<Source>>(); | 986 new HashMap<AnalysisContext, List<Source>>(); |
| 962 List<String> unanalyzed = new List<String>(); | 987 List<String> unanalyzed = new List<String>(); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1527 /** | 1552 /** |
| 1528 * The [PerformanceTag] for time spent in server request handlers. | 1553 * The [PerformanceTag] for time spent in server request handlers. |
| 1529 */ | 1554 */ |
| 1530 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1555 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1531 | 1556 |
| 1532 /** | 1557 /** |
| 1533 * The [PerformanceTag] for time spent in split store microtasks. | 1558 * The [PerformanceTag] for time spent in split store microtasks. |
| 1534 */ | 1559 */ |
| 1535 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1560 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1536 } | 1561 } |
| OLD | NEW |