Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: pkg/analyzer_plugin/lib/channel/channel.dart

Issue 2676633003: Add server-side communications channel (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/channel/channel.dart
diff --git a/pkg/analyzer_plugin/lib/channel/channel.dart b/pkg/analyzer_plugin/lib/channel/channel.dart
index 44f065efea583a7cd1ed2a5f6be41db134cd6be6..0d385e4f6c55df5e71de767d1c00dcdbd1de8214 100644
--- a/pkg/analyzer_plugin/lib/channel/channel.dart
+++ b/pkg/analyzer_plugin/lib/channel/channel.dart
@@ -5,8 +5,9 @@
import 'package:analyzer_plugin/protocol/protocol.dart';
/**
- * The object that allows a [ServerPlugin] to receive [Request]s and to return
- * both [Response]s and [Notification]s.
+ * A communication channel that allows a [ServerPlugin] to receive [Request]s
+ * from, and to return both [Response]s and [Notification]s to, an analysis
+ * server.
*
* Clients may not extend, implement or mix-in this class.
*/
@@ -36,3 +37,33 @@ abstract class PluginCommunicationChannel {
*/
void sendResponse(Response response);
}
+
+/**
+ * A communication channel that allows an analysis server to send [Request]s
+ * to, and to receive both [Response]s and [Notification]s from, a plugin.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ServerCommunicationChannel {
+ /**
+ * Close the communication channel.
+ */
+ void close();
+
+ /**
+ * Listen to the channel for responses and notifications. If a response is
+ * received, invoke the [onResponse] function. If a notification is received,
+ * invoke the [onNotification] function. If an error is encountered while
+ * trying to read from the socket, invoke the [onError] function. If the
+ * socket is closed by the client, invoke the [onDone] function. Only one
scheglov 2017/02/02 18:25:04 Is "the client" here code that uses ServerCommunic
Brian Wilkerson 2017/02/02 18:46:39 The plugin. I'll fix the wording, thanks.
+ * listener is allowed per channel.
+ */
+ void listen(void onResponse(Response response),
+ void onNotification(Notification notification),
+ {Function onError, void onDone()});
+
+ /**
+ * Send the given [request] to the plugin.
+ */
+ void sendRequest(Request request);
+}
« no previous file with comments | « no previous file | pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698