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 operation.analysis; | 5 library operation.analysis; |
6 | 6 |
7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; | 8 import 'package:analysis_server/src/computer/computer_highlights.dart'; |
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; | 9 import 'package:analysis_server/src/computer/computer_navigation.dart'; |
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; | 10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; |
11 import 'package:analysis_server/src/computer/computer_outline.dart'; | 11 import 'package:analysis_server/src/computer/computer_outline.dart'; |
12 import 'package:analysis_server/src/computer/computer_overrides.dart'; | 12 import 'package:analysis_server/src/computer/computer_overrides.dart'; |
13 import 'package:analysis_server/src/operation/operation.dart'; | 13 import 'package:analysis_server/src/operation/operation.dart'; |
14 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 14 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
15 import 'package:analysis_server/src/services/index/index.dart'; | 15 import 'package:analysis_server/src/services/index/index.dart'; |
16 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
17 import 'package:analyzer/src/generated/engine.dart'; | 17 import 'package:analyzer/src/generated/engine.dart'; |
18 import 'package:analyzer/src/generated/error.dart'; | 18 import 'package:analyzer/src/generated/error.dart'; |
19 import 'package:analyzer/src/generated/html.dart'; | 19 import 'package:analyzer/src/generated/html.dart'; |
20 import 'package:analyzer/src/generated/source.dart'; | 20 import 'package:analyzer/src/generated/source.dart'; |
| 21 import 'package:analyzer/src/generated/utilities_general.dart'; |
21 | 22 |
22 | 23 |
23 /** | 24 /** |
24 * Schedules sending notifications for the given [file] using the resolved | 25 * Schedules sending notifications for the given [file] using the resolved |
25 * [resolvedDartUnit]. | 26 * [resolvedDartUnit]. |
26 */ | 27 */ |
27 void scheduleNotificationOperations(AnalysisServer server, String file, | 28 void scheduleNotificationOperations(AnalysisServer server, String file, |
28 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, | 29 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, |
29 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { | 30 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { |
30 // Only send notifications if the current context is the preferred | 31 // Only send notifications if the current context is the preferred |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 AnalysisResult result = context.performAnalysisTask(); | 215 AnalysisResult result = context.performAnalysisTask(); |
215 List<ChangeNotice> notices = result.changeNotices; | 216 List<ChangeNotice> notices = result.changeNotices; |
216 if (notices == null) { | 217 if (notices == null) { |
217 _setCacheSize(IDLE_CACHE_SIZE); | 218 _setCacheSize(IDLE_CACHE_SIZE); |
218 server.sendContextAnalysisDoneNotifications( | 219 server.sendContextAnalysisDoneNotifications( |
219 context, | 220 context, |
220 AnalysisDoneReason.COMPLETE); | 221 AnalysisDoneReason.COMPLETE); |
221 return; | 222 return; |
222 } | 223 } |
223 // process results | 224 // process results |
224 _sendNotices(server, notices); | 225 PerformanceTag prevTag = ServerPerformanceStatistics.notices.makeCurrent(); |
225 _updateIndex(server, notices); | 226 try { |
| 227 _sendNotices(server, notices); |
| 228 ServerPerformanceStatistics.index.makeCurrent(); |
| 229 _updateIndex(server, notices); |
| 230 } finally { |
| 231 prevTag.makeCurrent(); |
| 232 } |
226 // continue analysis | 233 // continue analysis |
227 server.addOperation(new PerformAnalysisOperation(context, true)); | 234 server.addOperation(new PerformAnalysisOperation(context, true)); |
228 } | 235 } |
229 | 236 |
230 /** | 237 /** |
231 * Send the information in the given list of notices back to the client. | 238 * Send the information in the given list of notices back to the client. |
232 */ | 239 */ |
233 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { | 240 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { |
234 for (int i = 0; i < notices.length; i++) { | 241 for (int i = 0; i < notices.length; i++) { |
235 ChangeNotice notice = notices[i]; | 242 ChangeNotice notice = notices[i]; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 312 |
306 _DartIndexOperation(this.context, String file, this.unit) : super(file); | 313 _DartIndexOperation(this.context, String file, this.unit) : super(file); |
307 | 314 |
308 @override | 315 @override |
309 ServerOperationPriority get priority { | 316 ServerOperationPriority get priority { |
310 return ServerOperationPriority.ANALYSIS_INDEX; | 317 return ServerOperationPriority.ANALYSIS_INDEX; |
311 } | 318 } |
312 | 319 |
313 @override | 320 @override |
314 void perform(AnalysisServer server) { | 321 void perform(AnalysisServer server) { |
315 Index index = server.index; | 322 PerformanceTag prevTag = |
316 index.indexUnit(context, unit); | 323 ServerPerformanceStatistics.indexOperation.makeCurrent(); |
| 324 try { |
| 325 Index index = server.index; |
| 326 index.indexUnit(context, unit); |
| 327 } finally { |
| 328 prevTag.makeCurrent(); |
| 329 } |
317 } | 330 } |
318 } | 331 } |
319 | 332 |
320 | 333 |
321 class _DartNavigationOperation extends _DartNotificationOperation { | 334 class _DartNavigationOperation extends _DartNotificationOperation { |
322 _DartNavigationOperation(String file, CompilationUnit unit) | 335 _DartNavigationOperation(String file, CompilationUnit unit) |
323 : super(file, unit); | 336 : super(file, unit); |
324 | 337 |
325 @override | 338 @override |
326 void perform(AnalysisServer server) { | 339 void perform(AnalysisServer server) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 430 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
418 final String file; | 431 final String file; |
419 | 432 |
420 _SingleFileOperation(this.file); | 433 _SingleFileOperation(this.file); |
421 | 434 |
422 @override | 435 @override |
423 bool shouldBeDiscardedOnSourceChange(Source source) { | 436 bool shouldBeDiscardedOnSourceChange(Source source) { |
424 return source.fullName == file; | 437 return source.fullName == file; |
425 } | 438 } |
426 } | 439 } |
OLD | NEW |