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 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 completer = new Completer<AnalysisDoneReason>(); | 654 completer = new Completer<AnalysisDoneReason>(); |
| 655 contextAnalysisDoneCompleters[context] = completer; | 655 contextAnalysisDoneCompleters[context] = completer; |
| 656 } | 656 } |
| 657 return completer.future; | 657 return completer.future; |
| 658 } | 658 } |
| 659 | 659 |
| 660 /** | 660 /** |
| 661 * Perform the next available [ServerOperation]. | 661 * Perform the next available [ServerOperation]. |
| 662 */ | 662 */ |
| 663 void performOperation() { | 663 void performOperation() { |
| 664 assert(performOperationPending); | |
|
Paul Berry
2015/02/27 22:05:00
Why remove this assertion? AFAICT this invariant
scheglov
2015/02/28 01:34:35
I found the problem in my test code.
And you are r
| |
| 665 PerformanceTag.UNKNOWN.makeCurrent(); | 664 PerformanceTag.UNKNOWN.makeCurrent(); |
| 666 performOperationPending = false; | 665 performOperationPending = false; |
| 667 if (!running) { | 666 if (!running) { |
| 668 // An error has occurred, or the connection to the client has been | 667 // An error has occurred, or the connection to the client has been |
| 669 // closed, since this method was scheduled on the event queue. So | 668 // closed, since this method was scheduled on the event queue. So |
| 670 // don't do anything. Instead clear the operation queue. | 669 // don't do anything. Instead clear the operation queue. |
| 671 operationQueue.clear(); | 670 operationQueue.clear(); |
| 672 return; | 671 return; |
| 673 } | 672 } |
| 674 // prepare next operation | 673 // prepare next operation |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 oldContents, | 1022 oldContents, |
| 1024 newContents, | 1023 newContents, |
| 1025 true)) { | 1024 true)) { |
| 1026 schedulePerformAnalysisOperation(context); | 1025 schedulePerformAnalysisOperation(context); |
| 1027 } else { | 1026 } else { |
| 1028 // When the client sends any change for a source, we should resend | 1027 // When the client sends any change for a source, we should resend |
| 1029 // subscribed notifications, even if there were no changes in the | 1028 // subscribed notifications, even if there were no changes in the |
| 1030 // source contents. | 1029 // source contents. |
| 1031 // TODO(scheglov) consider checking if there are subscriptions. | 1030 // TODO(scheglov) consider checking if there are subscriptions. |
| 1032 if (AnalysisEngine.isDartFileName(file)) { | 1031 if (AnalysisEngine.isDartFileName(file)) { |
| 1033 CompilationUnit dartUnit = | 1032 List<CompilationUnit> dartUnits = |
| 1034 context.ensureAnyResolvedDartUnit(source); | 1033 context.ensureResolvedDartUnits(source); |
| 1035 if (dartUnit != null) { | 1034 if (dartUnits != null) { |
| 1036 AnalysisErrorInfo errorInfo = context.getErrors(source); | 1035 AnalysisErrorInfo errorInfo = context.getErrors(source); |
| 1037 scheduleNotificationOperations( | 1036 for (var dartUnit in dartUnits) { |
| 1038 this, | 1037 scheduleNotificationOperations( |
| 1039 file, | 1038 this, |
| 1040 errorInfo.lineInfo, | 1039 file, |
| 1041 context, | 1040 errorInfo.lineInfo, |
| 1042 null, | 1041 context, |
| 1043 dartUnit, | 1042 null, |
| 1044 errorInfo.errors); | 1043 dartUnit, |
| 1044 errorInfo.errors); | |
| 1045 scheduleIndexOperation(this, file, context, dartUnit); | |
| 1046 } | |
| 1045 } else { | 1047 } else { |
| 1046 schedulePerformAnalysisOperation(context); | 1048 schedulePerformAnalysisOperation(context); |
| 1047 } | 1049 } |
| 1048 } | 1050 } |
| 1049 } | 1051 } |
| 1050 } | 1052 } |
| 1051 }); | 1053 }); |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 /** | 1056 /** |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1372 /** | 1374 /** |
| 1373 * The [PerformanceTag] for time spent in server request handlers. | 1375 * The [PerformanceTag] for time spent in server request handlers. |
| 1374 */ | 1376 */ |
| 1375 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1377 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1376 | 1378 |
| 1377 /** | 1379 /** |
| 1378 * The [PerformanceTag] for time spent in split store microtasks. | 1380 * The [PerformanceTag] for time spent in split store microtasks. |
| 1379 */ | 1381 */ |
| 1380 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1382 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1381 } | 1383 } |
| OLD | NEW |