| 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 'package:analyzer_plugin/protocol/protocol.dart'; | 5 import 'package:analyzer_plugin/protocol/protocol.dart'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A communication channel that allows a [ServerPlugin] to receive [Request]s | 8 * A communication channel that allows a [ServerPlugin] to receive [Request]s |
| 9 * from, and to return both [Response]s and [Notification]s to, an analysis | 9 * from, and to return both [Response]s and [Notification]s to, an analysis |
| 10 * server. | 10 * server. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * | 44 * |
| 45 * Clients may not extend, implement or mix-in this class. | 45 * Clients may not extend, implement or mix-in this class. |
| 46 */ | 46 */ |
| 47 abstract class ServerCommunicationChannel { | 47 abstract class ServerCommunicationChannel { |
| 48 /** | 48 /** |
| 49 * Close the communication channel. | 49 * Close the communication channel. |
| 50 */ | 50 */ |
| 51 void close(); | 51 void close(); |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Cause the plugin to terminate as soon as possible. This should only be used |
| 55 * when the plugin has failed to terminate after sending it a 'plugin.shutdown
' |
| 56 * request. |
| 57 */ |
| 58 void kill(); |
| 59 |
| 60 /** |
| 54 * Listen to the channel for responses and notifications. If a response is | 61 * Listen to the channel for responses and notifications. If a response is |
| 55 * received, invoke the [onResponse] function. If a notification is received, | 62 * received, invoke the [onResponse] function. If a notification is received, |
| 56 * invoke the [onNotification] function. If an error is encountered while | 63 * invoke the [onNotification] function. If an error is encountered while |
| 57 * trying to read from the socket, invoke the [onError] function. If the | 64 * trying to read from the socket, invoke the [onError] function. If the |
| 58 * socket is closed by the plugin, invoke the [onDone] function. Only one | 65 * socket is closed by the plugin, invoke the [onDone] function. Only one |
| 59 * listener is allowed per channel. | 66 * listener is allowed per channel. |
| 60 */ | 67 */ |
| 61 void listen(void onResponse(Response response), | 68 void listen(void onResponse(Response response), |
| 62 void onNotification(Notification notification), | 69 void onNotification(Notification notification), |
| 63 {Function onError, void onDone()}); | 70 {Function onError, void onDone()}); |
| 64 | 71 |
| 65 /** | 72 /** |
| 66 * Send the given [request] to the plugin. | 73 * Send the given [request] to the plugin. |
| 67 */ | 74 */ |
| 68 void sendRequest(Request request); | 75 void sendRequest(Request request); |
| 69 } | 76 } |
| OLD | NEW |