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'; | 9 import 'dart:core'; |
10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * The channel from which requests are received and to which responses should | 119 * The channel from which requests are received and to which responses should |
120 * be sent. | 120 * be sent. |
121 */ | 121 */ |
122 final ServerCommunicationChannel channel; | 122 final ServerCommunicationChannel channel; |
123 | 123 |
124 /** | 124 /** |
125 * The object used to manage sending a subset of notifications to the client. | 125 * The object used to manage sending a subset of notifications to the client. |
126 * The subset of notifications are those to which plugins may contribute. | 126 * The subset of notifications are those to which plugins may contribute. |
127 * This field is `null` when the new plugin support is disabled. | 127 * This field is `null` when the new plugin support is disabled. |
128 */ | 128 */ |
129 final NotificationManager notificationManager = null; | 129 final NotificationManager notificationManager; |
130 | 130 |
131 /** | 131 /** |
132 * The [ResourceProvider] using which paths are converted into [Resource]s. | 132 * The [ResourceProvider] using which paths are converted into [Resource]s. |
133 */ | 133 */ |
134 final ResourceProvider resourceProvider; | 134 final ResourceProvider resourceProvider; |
135 | 135 |
136 /** | 136 /** |
137 * The [Index] for this server, may be `null` if indexing is disabled. | 137 * The [Index] for this server, may be `null` if indexing is disabled. |
138 */ | 138 */ |
139 final Index index; | 139 final Index index; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 PubPackageMapProvider packageMapProvider, | 367 PubPackageMapProvider packageMapProvider, |
368 this.index, | 368 this.index, |
369 this.serverPlugin, | 369 this.serverPlugin, |
370 this.options, | 370 this.options, |
371 this.sdkManager, | 371 this.sdkManager, |
372 this.instrumentationService, | 372 this.instrumentationService, |
373 {this.diagnosticServer, | 373 {this.diagnosticServer, |
374 ResolverProvider fileResolverProvider: null, | 374 ResolverProvider fileResolverProvider: null, |
375 ResolverProvider packageResolverProvider: null, | 375 ResolverProvider packageResolverProvider: null, |
376 bool useSingleContextManager: false, | 376 bool useSingleContextManager: false, |
377 this.rethrowExceptions: true}) { | 377 this.rethrowExceptions: true}) |
| 378 // TODO(brianwilkerson) Initialize notificationManager to |
| 379 // "new NotificationManager(channel, resourceProvider)" |
| 380 : notificationManager = null { |
378 _performance = performanceDuringStartup; | 381 _performance = performanceDuringStartup; |
379 defaultContextOptions.incremental = true; | 382 defaultContextOptions.incremental = true; |
380 defaultContextOptions.incrementalApi = | 383 defaultContextOptions.incrementalApi = |
381 options.enableIncrementalResolutionApi; | 384 options.enableIncrementalResolutionApi; |
382 defaultContextOptions.incrementalValidation = | 385 defaultContextOptions.incrementalValidation = |
383 options.enableIncrementalResolutionValidation; | 386 options.enableIncrementalResolutionValidation; |
384 defaultContextOptions.finerGrainedInvalidation = | 387 defaultContextOptions.finerGrainedInvalidation = |
385 options.finerGrainedInvalidation; | 388 options.finerGrainedInvalidation; |
386 defaultContextOptions.generateImplicitErrors = false; | 389 defaultContextOptions.generateImplicitErrors = false; |
387 operationQueue = new ServerOperationQueue(); | 390 operationQueue = new ServerOperationQueue(); |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 * | 1231 * |
1229 * The current implementation is intentionally simplified and expected | 1232 * The current implementation is intentionally simplified and expected |
1230 * that only folders are given each given folder corresponds to the exactly | 1233 * that only folders are given each given folder corresponds to the exactly |
1231 * one context. | 1234 * one context. |
1232 * | 1235 * |
1233 * So, we can start working in parallel on adding services and improving | 1236 * So, we can start working in parallel on adding services and improving |
1234 * projects/contexts support. | 1237 * projects/contexts support. |
1235 */ | 1238 */ |
1236 void setAnalysisRoots(String requestId, List<String> includedPaths, | 1239 void setAnalysisRoots(String requestId, List<String> includedPaths, |
1237 List<String> excludedPaths, Map<String, String> packageRoots) { | 1240 List<String> excludedPaths, Map<String, String> packageRoots) { |
| 1241 if (notificationManager != null) { |
| 1242 notificationManager.setAnalysisRoots(includedPaths, excludedPaths); |
| 1243 } |
1238 try { | 1244 try { |
1239 contextManager.setRoots(includedPaths, excludedPaths, packageRoots); | 1245 contextManager.setRoots(includedPaths, excludedPaths, packageRoots); |
1240 } on UnimplementedError catch (e) { | 1246 } on UnimplementedError catch (e) { |
1241 throw new RequestFailure( | 1247 throw new RequestFailure( |
1242 new Response.unsupportedFeature(requestId, e.message)); | 1248 new Response.unsupportedFeature(requestId, e.message)); |
1243 } | 1249 } |
1244 } | 1250 } |
1245 | 1251 |
1246 /** | 1252 /** |
1247 * Implementation for `analysis.setSubscriptions`. | 1253 * Implementation for `analysis.setSubscriptions`. |
1248 */ | 1254 */ |
1249 void setAnalysisSubscriptions( | 1255 void setAnalysisSubscriptions( |
1250 Map<AnalysisService, Set<String>> subscriptions) { | 1256 Map<AnalysisService, Set<String>> subscriptions) { |
| 1257 if (notificationManager != null) { |
| 1258 notificationManager.setSubscriptions(subscriptions); |
| 1259 } |
1251 if (options.enableNewAnalysisDriver) { | 1260 if (options.enableNewAnalysisDriver) { |
1252 this.analysisServices = subscriptions; | 1261 this.analysisServices = subscriptions; |
1253 Iterable<nd.AnalysisDriver> drivers = driverMap.values; | 1262 Iterable<nd.AnalysisDriver> drivers = driverMap.values; |
1254 if (drivers.isNotEmpty) { | 1263 if (drivers.isNotEmpty) { |
1255 Set<String> allNewFiles = | 1264 Set<String> allNewFiles = |
1256 subscriptions.values.expand((files) => files).toSet(); | 1265 subscriptions.values.expand((files) => files).toSet(); |
1257 for (String file in allNewFiles) { | 1266 for (String file in allNewFiles) { |
1258 nd.AnalysisDriver driver = drivers.firstWhere( | 1267 nd.AnalysisDriver driver = drivers.firstWhere( |
1259 (driver) => driver.addedFiles.contains(file), | 1268 (driver) => driver.addedFiles.contains(file), |
1260 orElse: () => drivers.first); | 1269 orElse: () => drivers.first); |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 /** | 2266 /** |
2258 * The [PerformanceTag] for time spent in server request handlers. | 2267 * The [PerformanceTag] for time spent in server request handlers. |
2259 */ | 2268 */ |
2260 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2269 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2261 | 2270 |
2262 /** | 2271 /** |
2263 * The [PerformanceTag] for time spent in split store microtasks. | 2272 * The [PerformanceTag] for time spent in split store microtasks. |
2264 */ | 2273 */ |
2265 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2274 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2266 } | 2275 } |
OLD | NEW |