| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 server.operation; | 5 library server.operation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 driver.logger.log(Level.FINE, 'Sending request: $method\n $json'); | 84 driver.logger.log(Level.FINE, 'Sending request: $method\n $json'); |
| 85 stopwatch.start(); | 85 stopwatch.start(); |
| 86 | 86 |
| 87 void recordResult(bool success, result) { | 87 void recordResult(bool success, result) { |
| 88 Duration elapsed = stopwatch.elapsed; | 88 Duration elapsed = stopwatch.elapsed; |
| 89 driver.results.record(method, elapsed, success: success); | 89 driver.results.record(method, elapsed, success: success); |
| 90 driver.logger | 90 driver.logger |
| 91 .log(Level.FINE, 'Response received: $method : $elapsed\n $result'); | 91 .log(Level.FINE, 'Response received: $method : $elapsed\n $result'); |
| 92 } | 92 } |
| 93 | 93 |
| 94 driver.send(method, json['params']).then((Map<String, dynamic> result) { | 94 driver |
| 95 .send(method, converter.asMap(json['params'])) |
| 96 .then((Map<String, dynamic> result) { |
| 95 recordResult(true, result); | 97 recordResult(true, result); |
| 96 processResult(originalId, result, stopwatch); | 98 processResult(originalId, result, stopwatch); |
| 97 }).catchError((exception) { | 99 }).catchError((exception) { |
| 98 recordResult(false, exception); | 100 recordResult(false, exception); |
| 99 converter.processErrorResponse(originalId, exception); | 101 converter.processErrorResponse(originalId, exception); |
| 100 }); | 102 }); |
| 101 return null; | 103 return null; |
| 102 } | 104 } |
| 103 | 105 |
| 104 void processResult( | 106 void processResult( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 subscription.cancel(); | 228 subscription.cancel(); |
| 227 timer.cancel(); | 229 timer.cancel(); |
| 228 String message = 'gave up waiting for analysis to complete'; | 230 String message = 'gave up waiting for analysis to complete'; |
| 229 driver.logger.log(Level.WARNING, message); | 231 driver.logger.log(Level.WARNING, message); |
| 230 completer.completeError(message); | 232 completer.completeError(message); |
| 231 } | 233 } |
| 232 }); | 234 }); |
| 233 return completer.future; | 235 return completer.future; |
| 234 } | 236 } |
| 235 } | 237 } |
| OLD | NEW |