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:math' show max; | 9 import 'dart:math' show max; |
10 | 10 |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 analysisServer.schedulePerformAnalysisOperation(context); | 1235 analysisServer.schedulePerformAnalysisOperation(context); |
1236 return context; | 1236 return context; |
1237 } | 1237 } |
1238 | 1238 |
1239 @override | 1239 @override |
1240 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { | 1240 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { |
1241 AnalysisContext context = analysisServer.folderMap[contextFolder]; | 1241 AnalysisContext context = analysisServer.folderMap[contextFolder]; |
1242 if (context != null) { | 1242 if (context != null) { |
1243 context.applyChanges(changeSet); | 1243 context.applyChanges(changeSet); |
1244 analysisServer.schedulePerformAnalysisOperation(context); | 1244 analysisServer.schedulePerformAnalysisOperation(context); |
| 1245 List<String> flushedFiles = new List<String>(); |
| 1246 for (Source source in changeSet.removedSources) { |
| 1247 flushedFiles.add(source.fullName); |
| 1248 } |
| 1249 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles); |
1245 } | 1250 } |
1246 } | 1251 } |
1247 | 1252 |
1248 @override | 1253 @override |
1249 void beginComputePackageMap() { | 1254 void beginComputePackageMap() { |
1250 _computingPackageMap(true); | 1255 _computingPackageMap(true); |
1251 } | 1256 } |
1252 | 1257 |
1253 @override | 1258 @override |
1254 void endComputePackageMap() { | 1259 void endComputePackageMap() { |
1255 _computingPackageMap(false); | 1260 _computingPackageMap(false); |
1256 } | 1261 } |
1257 | 1262 |
1258 @override | 1263 @override |
1259 void removeContext(Folder folder) { | 1264 void removeContext(Folder folder) { |
1260 AnalysisContext context = analysisServer.folderMap.remove(folder); | 1265 AnalysisContext context = analysisServer.folderMap.remove(folder); |
| 1266 |
| 1267 // See dartbug.com/22689, the AnalysisContext is computed in |
| 1268 // computeFlushedFiles instead of using the referenced context above, this |
| 1269 // is an attempt to be careful concerning the referenced issue. |
| 1270 List<String> flushedFiles = computeFlushedFiles(folder); |
| 1271 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles); |
| 1272 |
1261 if (analysisServer.index != null) { | 1273 if (analysisServer.index != null) { |
1262 analysisServer.index.removeContext(context); | 1274 analysisServer.index.removeContext(context); |
1263 } | 1275 } |
| 1276 analysisServer.operationQueue.contextRemoved(context); |
1264 _onContextsChangedController | 1277 _onContextsChangedController |
1265 .add(new ContextsChangedEvent(removed: [context])); | 1278 .add(new ContextsChangedEvent(removed: [context])); |
1266 analysisServer.sendContextAnalysisDoneNotifications( | 1279 analysisServer.sendContextAnalysisDoneNotifications( |
1267 context, AnalysisDoneReason.CONTEXT_REMOVED); | 1280 context, AnalysisDoneReason.CONTEXT_REMOVED); |
1268 context.dispose(); | 1281 context.dispose(); |
1269 } | 1282 } |
1270 | 1283 |
1271 @override | 1284 @override |
1272 void updateContextPackageUriResolver( | 1285 void updateContextPackageUriResolver( |
1273 Folder contextFolder, UriResolver packageUriResolver) { | 1286 Folder contextFolder, UriResolver packageUriResolver) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 /** | 1408 /** |
1396 * The [PerformanceTag] for time spent in server request handlers. | 1409 * The [PerformanceTag] for time spent in server request handlers. |
1397 */ | 1410 */ |
1398 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1411 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1399 | 1412 |
1400 /** | 1413 /** |
1401 * The [PerformanceTag] for time spent in split store microtasks. | 1414 * The [PerformanceTag] for time spent in split store microtasks. |
1402 */ | 1415 */ |
1403 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1416 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1404 } | 1417 } |
OLD | NEW |