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

Unified Diff: pkg/analyzer_plugin/lib/src/driver.dart

Issue 2667823003: Add top-level driver and abstract plugin superclass (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/src/driver.dart
diff --git a/pkg/analyzer_plugin/lib/src/driver.dart b/pkg/analyzer_plugin/lib/src/driver.dart
new file mode 100644
index 0000000000000000000000000000000000000000..340bc0a406cee641b3a47f1cca66c6d6904ac9f0
--- /dev/null
+++ b/pkg/analyzer_plugin/lib/src/driver.dart
@@ -0,0 +1,33 @@
+// 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 'dart:isolate';
+
+import 'package:analyzer_plugin/plugin/plugin.dart';
+import 'package:analyzer_plugin/src/channel/isolate_channel.dart';
+import 'package:analyzer_plugin/starter.dart';
+
+/**
+ * The [Driver] class represents a single running instance of an analysis
+ * server plugin. It is responsible for handling the communications with the
+ * server and forwarding requests on to the plugin.
+ */
+class Driver implements ServerPluginStarter {
+ /**
+ * The plugin that will be started.
+ */
+ final ServerPlugin plugin;
+
+ /**
+ * Initialize a newly created driver that can be used to start the given
+ * plugin.
+ */
+ Driver(this.plugin);
+
+ @override
+ void start(SendPort sendPort) {
+ IsolateChannel channel = new IsolateChannel(sendPort);
+ plugin.start(channel);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698