| 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 domain.completion; | 5 library domain.completion; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if (source == null) { | 150 if (source == null) { |
| 151 performance.complete('priorityChanged caching: no source'); | 151 performance.complete('priorityChanged caching: no source'); |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 performance.source = source; | 154 performance.source = source; |
| 155 AnalysisContext context = server.getAnalysisContextForSource(source); | 155 AnalysisContext context = server.getAnalysisContextForSource(source); |
| 156 if (context != null) { | 156 if (context != null) { |
| 157 String computeTag = 'computeCache'; | 157 String computeTag = 'computeCache'; |
| 158 performance.logStartTime(computeTag); | 158 performance.logStartTime(computeTag); |
| 159 CompletionManager manager = completionManagerFor(context, source); | 159 CompletionManager manager = completionManagerFor(context, source); |
| 160 manager.computeCache().then((bool success) { | 160 manager.computeCache().catchError((_) => false).then((bool success) { |
| 161 performance.logElapseTime(computeTag); | 161 performance.logElapseTime(computeTag); |
| 162 performance.complete('priorityChanged caching: $success'); | 162 performance.complete('priorityChanged caching: $success'); |
| 163 }); | 163 }); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 /** | 167 /** |
| 168 * Process a `completion.getSuggestions` request. | 168 * Process a `completion.getSuggestions` request. |
| 169 */ | 169 */ |
| 170 Response processRequest(Request request, [CompletionManager manager]) { | 170 Response processRequest(Request request, [CompletionManager manager]) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (_sourcesChangedSubscription != null) { | 270 if (_sourcesChangedSubscription != null) { |
| 271 _sourcesChangedSubscription.cancel(); | 271 _sourcesChangedSubscription.cancel(); |
| 272 _sourcesChangedSubscription = null; | 272 _sourcesChangedSubscription = null; |
| 273 } | 273 } |
| 274 if (_manager != null) { | 274 if (_manager != null) { |
| 275 _manager.dispose(); | 275 _manager.dispose(); |
| 276 _manager = null; | 276 _manager = null; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| OLD | NEW |