| 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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 /** | 1246 /** |
| 1247 * Implementation for `analysis.setSubscriptions`. | 1247 * Implementation for `analysis.setSubscriptions`. |
| 1248 */ | 1248 */ |
| 1249 void setAnalysisSubscriptions( | 1249 void setAnalysisSubscriptions( |
| 1250 Map<AnalysisService, Set<String>> subscriptions) { | 1250 Map<AnalysisService, Set<String>> subscriptions) { |
| 1251 if (notificationManager != null) { | 1251 if (notificationManager != null) { |
| 1252 notificationManager.setSubscriptions(subscriptions); | 1252 notificationManager.setSubscriptions(subscriptions); |
| 1253 } | 1253 } |
| 1254 if (options.enableNewAnalysisDriver) { | 1254 if (options.enableNewAnalysisDriver) { |
| 1255 this.analysisServices = subscriptions; | 1255 this.analysisServices = subscriptions; |
| 1256 Iterable<nd.AnalysisDriver> drivers = driverMap.values; | 1256 Set<String> allNewFiles = |
| 1257 if (drivers.isNotEmpty) { | 1257 subscriptions.values.expand((files) => files).toSet(); |
| 1258 Set<String> allNewFiles = | 1258 for (String file in allNewFiles) { |
| 1259 subscriptions.values.expand((files) => files).toSet(); | 1259 // The result will be produced by the "results" stream with |
| 1260 for (String file in allNewFiles) { | 1260 // the fully resolved unit, and processed with sending analysis |
| 1261 nd.AnalysisDriver driver = drivers.firstWhere( | 1261 // notifications as it happens after content changes. |
| 1262 (driver) => driver.addedFiles.contains(file), | 1262 if (AnalysisEngine.isDartFileName(file)) { |
| 1263 orElse: () => drivers.first); | 1263 getAnalysisResult(file); |
| 1264 // The result will be produced by the "results" stream with | |
| 1265 // the fully resolved unit, and processed with sending analysis | |
| 1266 // notifications as it happens after content changes. | |
| 1267 driver.getResult(file).catchError((exception, stackTrace) {}); | |
| 1268 } | 1264 } |
| 1269 } | 1265 } |
| 1270 return; | 1266 return; |
| 1271 } | 1267 } |
| 1272 // send notifications for already analyzed sources | 1268 // send notifications for already analyzed sources |
| 1273 subscriptions.forEach((service, Set<String> newFiles) { | 1269 subscriptions.forEach((service, Set<String> newFiles) { |
| 1274 Set<String> oldFiles = analysisServices[service]; | 1270 Set<String> oldFiles = analysisServices[service]; |
| 1275 Set<String> todoFiles = | 1271 Set<String> todoFiles = |
| 1276 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; | 1272 oldFiles != null ? newFiles.difference(oldFiles) : newFiles; |
| 1277 for (String file in todoFiles) { | 1273 for (String file in todoFiles) { |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 /** | 2255 /** |
| 2260 * The [PerformanceTag] for time spent in server request handlers. | 2256 * The [PerformanceTag] for time spent in server request handlers. |
| 2261 */ | 2257 */ |
| 2262 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2258 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2263 | 2259 |
| 2264 /** | 2260 /** |
| 2265 * The [PerformanceTag] for time spent in split store microtasks. | 2261 * The [PerformanceTag] for time spent in split store microtasks. |
| 2266 */ | 2262 */ |
| 2267 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2263 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2268 } | 2264 } |
| OLD | NEW |