| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * A list of code completion peformance measurements for the latest | 52 * A list of code completion peformance measurements for the latest |
| 53 * completion operation up to [performanceListMaxLength] measurements. | 53 * completion operation up to [performanceListMaxLength] measurements. |
| 54 */ | 54 */ |
| 55 final List<CompletionPerformance> performanceList = | 55 final List<CompletionPerformance> performanceList = |
| 56 new List<CompletionPerformance>(); | 56 new List<CompletionPerformance>(); |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * The maximum number of performance measurements to keep. | 59 * The maximum number of performance measurements to keep. |
| 60 * This defaults to zero for efficiency, but clients may change this. | |
| 61 */ | 60 */ |
| 62 int performanceListMaxLength = 0; | 61 static const int performanceListMaxLength = 50; |
| 63 | 62 |
| 64 /** | 63 /** |
| 65 * Performance for the last priority change event. | 64 * Performance for the last priority change event. |
| 66 */ | 65 */ |
| 67 CompletionPerformance priorityChangedPerformance; | 66 CompletionPerformance priorityChangedPerformance; |
| 68 | 67 |
| 69 /** | 68 /** |
| 70 * Initialize a new request handler for the given [server]. | 69 * Initialize a new request handler for the given [server]. |
| 71 */ | 70 */ |
| 72 CompletionDomainHandler(this.server) { | 71 CompletionDomainHandler(this.server) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 performance.logElapseTime("notification $notificationCount send", () { | 177 performance.logElapseTime("notification $notificationCount send", () { |
| 179 sendCompletionNotification( | 178 sendCompletionNotification( |
| 180 completionId, | 179 completionId, |
| 181 result.replacementOffset, | 180 result.replacementOffset, |
| 182 result.replacementLength, | 181 result.replacementLength, |
| 183 result.suggestions, | 182 result.suggestions, |
| 184 result.last); | 183 result.last); |
| 185 }); | 184 }); |
| 186 if (notificationCount == 1) { | 185 if (notificationCount == 1) { |
| 187 performance.logFirstNotificationComplete('notification 1 complete'); | 186 performance.logFirstNotificationComplete('notification 1 complete'); |
| 187 performance.suggestionCountFirst = result.suggestions.length; |
| 188 } | 188 } |
| 189 if (result.last) { | 189 if (result.last) { |
| 190 performance.notificationCount = notificationCount; | 190 performance.notificationCount = notificationCount; |
| 191 performance.suggestionCount = result.suggestions.length; | 191 performance.suggestionCountLast = result.suggestions.length; |
| 192 performance.complete(); | 192 performance.complete(); |
| 193 } | 193 } |
| 194 }); | 194 }); |
| 195 // initial response without results | 195 // initial response without results |
| 196 return new CompletionGetSuggestionsResult( | 196 return new CompletionGetSuggestionsResult( |
| 197 completionId).toResponse(request.id); | 197 completionId).toResponse(request.id); |
| 198 } | 198 } |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * If tracking code completion performance over time, then | 201 * If tracking code completion performance over time, then |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (_sourcesChangedSubscription != null) { | 267 if (_sourcesChangedSubscription != null) { |
| 268 _sourcesChangedSubscription.cancel(); | 268 _sourcesChangedSubscription.cancel(); |
| 269 _sourcesChangedSubscription = null; | 269 _sourcesChangedSubscription = null; |
| 270 } | 270 } |
| 271 if (_manager != null) { | 271 if (_manager != null) { |
| 272 _manager.dispose(); | 272 _manager.dispose(); |
| 273 _manager = null; | 273 _manager = null; |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 } | 276 } |
| OLD | NEW |