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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 } | 1166 } |
1167 } | 1167 } |
1168 | 1168 |
1169 /** | 1169 /** |
1170 * Set up a [SourceFactory] that resolves packages using the given | 1170 * Set up a [SourceFactory] that resolves packages using the given |
1171 * [packageUriResolver]. | 1171 * [packageUriResolver]. |
1172 */ | 1172 */ |
1173 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { | 1173 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { |
1174 List<UriResolver> resolvers = <UriResolver>[ | 1174 List<UriResolver> resolvers = <UriResolver>[ |
1175 new DartUriResolver(analysisServer.defaultSdk), | 1175 new DartUriResolver(analysisServer.defaultSdk), |
1176 new ResourceUriResolver(resourceProvider), | 1176 new ResourceUriResolver(resourceProvider)]; |
1177 packageUriResolver]; | 1177 if (packageUriResolver != null) { |
| 1178 resolvers.add(packageUriResolver); |
| 1179 } |
1178 return new SourceFactory(resolvers); | 1180 return new SourceFactory(resolvers); |
1179 } | 1181 } |
1180 } | 1182 } |
1181 | 1183 |
1182 | 1184 |
1183 /** | 1185 /** |
1184 * A class used by [AnalysisServer] to record performance information | 1186 * A class used by [AnalysisServer] to record performance information |
1185 * such as request latency. | 1187 * such as request latency. |
1186 */ | 1188 */ |
1187 class ServerPerformance { | 1189 class ServerPerformance { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 new DateTime.now().millisecondsSinceEpoch - | 1224 new DateTime.now().millisecondsSinceEpoch - |
1223 request.clientRequestTime; | 1225 request.clientRequestTime; |
1224 requestLatency += latency; | 1226 requestLatency += latency; |
1225 maxLatency = max(maxLatency, latency); | 1227 maxLatency = max(maxLatency, latency); |
1226 if (latency > 150) { | 1228 if (latency > 150) { |
1227 ++slowRequestCount; | 1229 ++slowRequestCount; |
1228 } | 1230 } |
1229 } | 1231 } |
1230 } | 1232 } |
1231 } | 1233 } |
OLD | NEW |