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:isolate'; | 6 import 'dart:isolate'; |
7 | 7 |
8 import 'package:analyzer_plugin/channel/channel.dart'; | 8 import 'package:analyzer_plugin/channel/channel.dart'; |
9 import 'package:analyzer_plugin/protocol/protocol.dart'; | 9 import 'package:analyzer_plugin/protocol/protocol.dart'; |
10 | 10 |
11 /** | 11 /** |
12 * The object that allows a [ServerPlugin] to receive [Request]s and to return | 12 * The object that allows a [ServerPlugin] to receive [Request]s and to return |
13 * both [Response]s and [Notification]s. | 13 * both [Response]s and [Notification]s. It communicates with the analysis |
| 14 * server by passing data to the server's main isolate. |
14 */ | 15 */ |
15 class IsolateChannel implements PluginCommunicationChannel { | 16 class IsolateChannel implements PluginCommunicationChannel { |
16 /** | 17 /** |
17 * The port used to send notifications and responses to the server. | 18 * The port used to send notifications and responses to the server. |
18 */ | 19 */ |
19 SendPort _sendPort; | 20 SendPort _sendPort; |
20 | 21 |
21 /** | 22 /** |
22 * The port used to receive requests from the server. | 23 * The port used to receive requests from the server. |
23 */ | 24 */ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 @override | 66 @override |
66 void sendNotification(Notification notification) { | 67 void sendNotification(Notification notification) { |
67 _sendPort.send(notification.toJson()); | 68 _sendPort.send(notification.toJson()); |
68 } | 69 } |
69 | 70 |
70 @override | 71 @override |
71 void sendResponse(Response response) { | 72 void sendResponse(Response response) { |
72 _sendPort.send(response.toJson()); | 73 _sendPort.send(response.toJson()); |
73 } | 74 } |
74 } | 75 } |
OLD | NEW |