| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:io' show Platform; | 7 import 'dart:io' show Platform; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/plugin/notification_manager.dart'; | 9 import 'package:analysis_server/src/plugin/notification_manager.dart'; |
| 10 import 'package:analyzer/context/context_root.dart' as analyzer; | 10 import 'package:analyzer/context/context_root.dart' as analyzer; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 channel.close(); | 741 channel.close(); |
| 742 channel = null; | 742 channel = null; |
| 743 pluginStoppedCompleter.complete(null); | 743 pluginStoppedCompleter.complete(null); |
| 744 } | 744 } |
| 745 | 745 |
| 746 /** | 746 /** |
| 747 * Handle the fact that an unhandled error has occurred in the plugin. | 747 * Handle the fact that an unhandled error has occurred in the plugin. |
| 748 */ | 748 */ |
| 749 void handleOnError(List<String> errorPair) { | 749 void handleOnError(List<String> errorPair) { |
| 750 // TODO(brianwilkerson) Decide how we want to handle errors. | 750 // TODO(brianwilkerson) Decide how we want to handle errors. |
| 751 // String message = errorPair[0]; | 751 info.instrumentationService.logPluginException( |
| 752 // String stackTrace = errorPair[1]; | 752 info.data, errorPair[0], new StackTrace.fromString(errorPair[1])); |
| 753 // print('PluginSession.handleOnError'); | |
| 754 // print(' plugin = ${info.executionPath}'); | |
| 755 // print(' $message'); | |
| 756 // print(' ${new StackTrace.fromString(stackTrace)}'); | |
| 757 // pluginStoppedCompleter.completeError(message, new StackTrace.fromString(st
ackTrace)); | |
| 758 } | 753 } |
| 759 | 754 |
| 760 /** | 755 /** |
| 761 * Handle a [response] from the plugin by completing the future that was | 756 * Handle a [response] from the plugin by completing the future that was |
| 762 * created when the request was sent. | 757 * created when the request was sent. |
| 763 */ | 758 */ |
| 764 void handleResponse(Response response) { | 759 void handleResponse(Response response) { |
| 765 _PendingRequest requestData = pendingRequests.remove(response.id); | 760 _PendingRequest requestData = pendingRequests.remove(response.id); |
| 766 int responseTime = new DateTime.now().millisecondsSinceEpoch; | 761 int responseTime = new DateTime.now().millisecondsSinceEpoch; |
| 767 int duration = responseTime - requestData.requestTime; | 762 int duration = responseTime - requestData.requestTime; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 * The completer that will be used to complete the future when the response is | 879 * The completer that will be used to complete the future when the response is |
| 885 * received from the plugin. | 880 * received from the plugin. |
| 886 */ | 881 */ |
| 887 final Completer<Response> completer; | 882 final Completer<Response> completer; |
| 888 | 883 |
| 889 /** | 884 /** |
| 890 * Initialize a pending request. | 885 * Initialize a pending request. |
| 891 */ | 886 */ |
| 892 _PendingRequest(this.method, this.requestTime, this.completer); | 887 _PendingRequest(this.method, this.requestTime, this.completer); |
| 893 } | 888 } |
| OLD | NEW |