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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 ServerStatusParams params = new ServerStatusParams(pub: pubStatus); | 1226 ServerStatusParams params = new ServerStatusParams(pub: pubStatus); |
1227 analysisServer.sendNotification(params.toNotification()); | 1227 analysisServer.sendNotification(params.toNotification()); |
1228 } | 1228 } |
1229 } | 1229 } |
1230 | 1230 |
1231 /** | 1231 /** |
1232 * Set up a [SourceFactory] that resolves packages using the given | 1232 * Set up a [SourceFactory] that resolves packages using the given |
1233 * [packageUriResolver]. | 1233 * [packageUriResolver]. |
1234 */ | 1234 */ |
1235 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { | 1235 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { |
1236 List<UriResolver> resolvers = <UriResolver>[ | 1236 UriResolver dartResolver = new DartUriResolver(analysisServer.defaultSdk); |
1237 new DartUriResolver(analysisServer.defaultSdk), | 1237 UriResolver resourceResolver = new ResourceUriResolver(resourceProvider); |
1238 new ResourceUriResolver(resourceProvider)]; | 1238 List<UriResolver> resolvers = packageUriResolver != null ? |
1239 if (packageUriResolver != null) { | 1239 <UriResolver>[dartResolver, packageUriResolver, resourceResolver] : |
1240 resolvers.add(packageUriResolver); | 1240 <UriResolver>[dartResolver, resourceResolver]; |
1241 } | |
1242 return new SourceFactory(resolvers); | 1241 return new SourceFactory(resolvers); |
1243 } | 1242 } |
1244 } | 1243 } |
1245 | 1244 |
1246 | 1245 |
1247 /** | 1246 /** |
1248 * A class used by [AnalysisServer] to record performance information | 1247 * A class used by [AnalysisServer] to record performance information |
1249 * such as request latency. | 1248 * such as request latency. |
1250 */ | 1249 */ |
1251 class ServerPerformance { | 1250 class ServerPerformance { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 new DateTime.now().millisecondsSinceEpoch - | 1285 new DateTime.now().millisecondsSinceEpoch - |
1287 request.clientRequestTime; | 1286 request.clientRequestTime; |
1288 requestLatency += latency; | 1287 requestLatency += latency; |
1289 maxLatency = max(maxLatency, latency); | 1288 maxLatency = max(maxLatency, latency); |
1290 if (latency > 150) { | 1289 if (latency > 150) { |
1291 ++slowRequestCount; | 1290 ++slowRequestCount; |
1292 } | 1291 } |
1293 } | 1292 } |
1294 } | 1293 } |
1295 } | 1294 } |
OLD | NEW |