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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 * server. | 107 * server. |
108 */ | 108 */ |
109 List<RequestHandler> handlers; | 109 List<RequestHandler> handlers; |
110 | 110 |
111 /** | 111 /** |
112 * The current default [DartSdk]. | 112 * The current default [DartSdk]. |
113 */ | 113 */ |
114 final DartSdk defaultSdk; | 114 final DartSdk defaultSdk; |
115 | 115 |
116 /** | 116 /** |
117 * The instrumentation server that is to be used by this analysis server. | 117 * The instrumentation service that is to be used by this analysis server. |
118 */ | 118 */ |
119 final InstrumentationServer instrumentationServer; | 119 final InstrumentationService instrumentationService; |
120 | 120 |
121 /** | 121 /** |
122 * A table mapping [Folder]s to the [AnalysisContext]s associated with them. | 122 * A table mapping [Folder]s to the [AnalysisContext]s associated with them. |
123 */ | 123 */ |
124 final Map<Folder, AnalysisContext> folderMap = | 124 final Map<Folder, AnalysisContext> folderMap = |
125 new HashMap<Folder, AnalysisContext>(); | 125 new HashMap<Folder, AnalysisContext>(); |
126 | 126 |
127 /** | 127 /** |
128 * A queue of the operations to perform in this server. | 128 * A queue of the operations to perform in this server. |
129 */ | 129 */ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 * responses to the given [channel]. | 184 * responses to the given [channel]. |
185 * | 185 * |
186 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are | 186 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are |
187 * propagated up the call stack. The default is true to allow analysis | 187 * propagated up the call stack. The default is true to allow analysis |
188 * exceptions to show up in unit tests, but it should be set to false when | 188 * exceptions to show up in unit tests, but it should be set to false when |
189 * running a full analysis server. | 189 * running a full analysis server. |
190 */ | 190 */ |
191 AnalysisServer(this.channel, this.resourceProvider, | 191 AnalysisServer(this.channel, this.resourceProvider, |
192 PackageMapProvider packageMapProvider, this.index, | 192 PackageMapProvider packageMapProvider, this.index, |
193 AnalysisServerOptions analysisServerOptions, this.defaultSdk, | 193 AnalysisServerOptions analysisServerOptions, this.defaultSdk, |
194 this.instrumentationServer, {this.rethrowExceptions: true}) { | 194 this.instrumentationService, {this.rethrowExceptions: true}) { |
195 searchEngine = createSearchEngine(index); | 195 searchEngine = createSearchEngine(index); |
196 operationQueue = new ServerOperationQueue(this); | 196 operationQueue = new ServerOperationQueue(this); |
197 contextDirectoryManager = | 197 contextDirectoryManager = |
198 new ServerContextManager(this, resourceProvider, packageMapProvider); | 198 new ServerContextManager(this, resourceProvider, packageMapProvider); |
199 contextDirectoryManager.defaultOptions.incremental = | 199 contextDirectoryManager.defaultOptions.incremental = |
200 analysisServerOptions.enableIncrementalResolution; | 200 analysisServerOptions.enableIncrementalResolution; |
201 contextDirectoryManager.defaultOptions.incrementalApi = | 201 contextDirectoryManager.defaultOptions.incrementalApi = |
202 analysisServerOptions.enableIncrementalResolutionApi; | 202 analysisServerOptions.enableIncrementalResolutionApi; |
203 AnalysisEngine.instance.logger = new AnalysisLogger(); | 203 AnalysisEngine.instance.logger = new AnalysisLogger(); |
204 _onAnalysisStartedController = new StreamController.broadcast(); | 204 _onAnalysisStartedController = new StreamController.broadcast(); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 void shutdown() { | 817 void shutdown() { |
818 running = false; | 818 running = false; |
819 if (index != null) { | 819 if (index != null) { |
820 index.clear(); | 820 index.clear(); |
821 index.stop(); | 821 index.stop(); |
822 } | 822 } |
823 // Defer closing the channel and shutting down the instrumentation server so | 823 // Defer closing the channel and shutting down the instrumentation server so |
824 // that the shutdown response can be sent and logged. | 824 // that the shutdown response can be sent and logged. |
825 new Future(() { | 825 new Future(() { |
826 channel.close(); | 826 channel.close(); |
827 instrumentationServer.shutdown(); | 827 instrumentationService.shutdown(); |
828 }); | 828 }); |
829 } | 829 } |
830 | 830 |
831 /** | 831 /** |
832 * Implementation for `analysis.updateContent`. | 832 * Implementation for `analysis.updateContent`. |
833 */ | 833 */ |
834 void updateContent(String id, Map<String, dynamic> changes) { | 834 void updateContent(String id, Map<String, dynamic> changes) { |
835 changes.forEach((file, change) { | 835 changes.forEach((file, change) { |
836 AnalysisContext analysisContext = getAnalysisContext(file); | 836 AnalysisContext analysisContext = getAnalysisContext(file); |
837 // TODO(paulberry): handle the case where a file is referred to by more | 837 // TODO(paulberry): handle the case where a file is referred to by more |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 * [packageUriResolver]. | 1051 * [packageUriResolver]. |
1052 */ | 1052 */ |
1053 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { | 1053 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { |
1054 List<UriResolver> resolvers = <UriResolver>[ | 1054 List<UriResolver> resolvers = <UriResolver>[ |
1055 new DartUriResolver(analysisServer.defaultSdk), | 1055 new DartUriResolver(analysisServer.defaultSdk), |
1056 new ResourceUriResolver(resourceProvider), | 1056 new ResourceUriResolver(resourceProvider), |
1057 packageUriResolver]; | 1057 packageUriResolver]; |
1058 return new SourceFactory(resolvers); | 1058 return new SourceFactory(resolvers); |
1059 } | 1059 } |
1060 } | 1060 } |
OLD | NEW |