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

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

Issue 2666143002: Add a channel to communication with server (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
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
new file mode 100644
index 0000000000000000000000000000000000000000..44f065efea583a7cd1ed2a5f6be41db134cd6be6
--- /dev/null
+++ b/pkg/analyzer_plugin/lib/channel/channel.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+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.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class PluginCommunicationChannel {
+ /**
+ * Close the communication channel.
+ */
+ void close();
+
+ /**
+ * Listen to the channel for requests. If a request is received, invoke the
+ * [onRequest] 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 listener is allowed per
+ * channel.
+ */
+ void listen(void onRequest(Request request),
+ {Function onError, void onDone()});
+
+ /**
+ * Send the given [notification] to the server.
+ */
+ void sendNotification(Notification notification);
+
+ /**
+ * Send the given [response] to the server.
+ */
+ void sendResponse(Response response);
+}

Powered by Google App Engine
This is Rietveld 408576698