| 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' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 * | 750 * |
| 751 * 2. We should complete the future as soon as the file is analyzed (not wait | 751 * 2. We should complete the future as soon as the file is analyzed (not wait |
| 752 * until the context is completely finished) | 752 * until the context is completely finished) |
| 753 */ | 753 */ |
| 754 Future<AnalysisDoneReason> onFileAnalysisComplete(String file) { | 754 Future<AnalysisDoneReason> onFileAnalysisComplete(String file) { |
| 755 // prepare AnalysisContext | 755 // prepare AnalysisContext |
| 756 AnalysisContext context = getAnalysisContext(file); | 756 AnalysisContext context = getAnalysisContext(file); |
| 757 if (context == null) { | 757 if (context == null) { |
| 758 return null; | 758 return null; |
| 759 } | 759 } |
| 760 // done if everything is already analyzed |
| 761 if (isAnalysisComplete()) { |
| 762 return new Future.value(AnalysisDoneReason.COMPLETE); |
| 763 } |
| 760 // schedule context analysis | 764 // schedule context analysis |
| 761 schedulePerformAnalysisOperation(context); | 765 schedulePerformAnalysisOperation(context); |
| 762 // associate with the context completer | 766 // associate with the context completer |
| 763 Completer<AnalysisDoneReason> completer = | 767 Completer<AnalysisDoneReason> completer = |
| 764 contextAnalysisDoneCompleters[context]; | 768 contextAnalysisDoneCompleters[context]; |
| 765 if (completer == null) { | 769 if (completer == null) { |
| 766 completer = new Completer<AnalysisDoneReason>(); | 770 completer = new Completer<AnalysisDoneReason>(); |
| 767 contextAnalysisDoneCompleters[context] = completer; | 771 contextAnalysisDoneCompleters[context] = completer; |
| 768 } | 772 } |
| 769 return completer.future; | 773 return completer.future; |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1640 /** | 1644 /** |
| 1641 * The [PerformanceTag] for time spent in server request handlers. | 1645 * The [PerformanceTag] for time spent in server request handlers. |
| 1642 */ | 1646 */ |
| 1643 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1647 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1644 | 1648 |
| 1645 /** | 1649 /** |
| 1646 * The [PerformanceTag] for time spent in split store microtasks. | 1650 * The [PerformanceTag] for time spent in split store microtasks. |
| 1647 */ | 1651 */ |
| 1648 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1652 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1649 } | 1653 } |
| OLD | NEW |