Chromium Code Reviews| 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'; | |
| 22 | 21 |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * Schedules sending notifications for the given [file] using the resolved | 24 * Schedules sending notifications for the given [file] using the resolved |
| 26 * [resolvedDartUnit]. | 25 * [resolvedDartUnit]. |
| 27 */ | 26 */ |
| 28 void scheduleNotificationOperations(AnalysisServer server, String file, | 27 void scheduleNotificationOperations(AnalysisServer server, String file, |
| 29 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, | 28 LineInfo lineInfo, AnalysisContext context, CompilationUnit parsedDartUnit, |
| 30 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { | 29 CompilationUnit resolvedDartUnit, List<AnalysisError> errors) { |
| 31 // Only send notifications if the current context is the preferred | 30 // Only send notifications if the current context is the preferred |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 AnalysisResult result = context.performAnalysisTask(); | 214 AnalysisResult result = context.performAnalysisTask(); |
| 216 List<ChangeNotice> notices = result.changeNotices; | 215 List<ChangeNotice> notices = result.changeNotices; |
| 217 if (notices == null) { | 216 if (notices == null) { |
| 218 _setCacheSize(IDLE_CACHE_SIZE); | 217 _setCacheSize(IDLE_CACHE_SIZE); |
| 219 server.sendContextAnalysisDoneNotifications( | 218 server.sendContextAnalysisDoneNotifications( |
| 220 context, | 219 context, |
| 221 AnalysisDoneReason.COMPLETE); | 220 AnalysisDoneReason.COMPLETE); |
| 222 return; | 221 return; |
| 223 } | 222 } |
| 224 // process results | 223 // process results |
| 225 PerformanceTag prevTag = ServerPerformanceStatistics.notices.makeCurrent(); | 224 ServerPerformanceStatistics.notices.makeCurrentWhile(() { |
| 226 try { | |
| 227 _sendNotices(server, notices); | 225 _sendNotices(server, notices); |
| 228 ServerPerformanceStatistics.index.makeCurrent(); | |
| 229 _updateIndex(server, notices); | 226 _updateIndex(server, notices); |
|
Brian Wilkerson
2015/02/24 22:31:07
The execution of _updateIndex is no longer counted
scheglov
2015/02/24 22:33:05
Yes.
All what it does is just scheduling indexing,
| |
| 230 } finally { | 227 }); |
| 231 prevTag.makeCurrent(); | |
| 232 } | |
| 233 // continue analysis | 228 // continue analysis |
| 234 server.addOperation(new PerformAnalysisOperation(context, true)); | 229 server.addOperation(new PerformAnalysisOperation(context, true)); |
| 235 } | 230 } |
| 236 | 231 |
| 237 /** | 232 /** |
| 238 * Send the information in the given list of notices back to the client. | 233 * Send the information in the given list of notices back to the client. |
| 239 */ | 234 */ |
| 240 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { | 235 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { |
| 241 for (int i = 0; i < notices.length; i++) { | 236 for (int i = 0; i < notices.length; i++) { |
| 242 ChangeNotice notice = notices[i]; | 237 ChangeNotice notice = notices[i]; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 | 307 |
| 313 _DartIndexOperation(this.context, String file, this.unit) : super(file); | 308 _DartIndexOperation(this.context, String file, this.unit) : super(file); |
| 314 | 309 |
| 315 @override | 310 @override |
| 316 ServerOperationPriority get priority { | 311 ServerOperationPriority get priority { |
| 317 return ServerOperationPriority.ANALYSIS_INDEX; | 312 return ServerOperationPriority.ANALYSIS_INDEX; |
| 318 } | 313 } |
| 319 | 314 |
| 320 @override | 315 @override |
| 321 void perform(AnalysisServer server) { | 316 void perform(AnalysisServer server) { |
| 322 PerformanceTag prevTag = | 317 ServerPerformanceStatistics.indexOperation.makeCurrentWhile(() { |
| 323 ServerPerformanceStatistics.indexOperation.makeCurrent(); | |
| 324 try { | |
| 325 Index index = server.index; | 318 Index index = server.index; |
| 326 index.indexUnit(context, unit); | 319 index.indexUnit(context, unit); |
| 327 } finally { | 320 }); |
| 328 prevTag.makeCurrent(); | |
| 329 } | |
| 330 } | 321 } |
| 331 } | 322 } |
| 332 | 323 |
| 333 | 324 |
| 334 class _DartNavigationOperation extends _DartNotificationOperation { | 325 class _DartNavigationOperation extends _DartNotificationOperation { |
| 335 _DartNavigationOperation(String file, CompilationUnit unit) | 326 _DartNavigationOperation(String file, CompilationUnit unit) |
| 336 : super(file, unit); | 327 : super(file, unit); |
| 337 | 328 |
| 338 @override | 329 @override |
| 339 void perform(AnalysisServer server) { | 330 void perform(AnalysisServer server) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 abstract class _SingleFileOperation extends SourceSensitiveOperation { | 421 abstract class _SingleFileOperation extends SourceSensitiveOperation { |
| 431 final String file; | 422 final String file; |
| 432 | 423 |
| 433 _SingleFileOperation(this.file); | 424 _SingleFileOperation(this.file); |
| 434 | 425 |
| 435 @override | 426 @override |
| 436 bool shouldBeDiscardedOnSourceChange(Source source) { | 427 bool shouldBeDiscardedOnSourceChange(Source source) { |
| 437 return source.fullName == file; | 428 return source.fullName == file; |
| 438 } | 429 } |
| 439 } | 430 } |
| OLD | NEW |