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:convert'; | 6 import 'dart:convert'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 | 8 |
9 import 'package:analyzer/instrumentation/instrumentation.dart'; | 9 import 'package:analyzer/instrumentation/instrumentation.dart'; |
10 import 'package:analyzer_plugin/channel/channel.dart'; | 10 import 'package:analyzer_plugin/channel/channel.dart'; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 instrumentationService.logPluginNotification(pluginId, encodedInput); | 273 instrumentationService.logPluginNotification(pluginId, encodedInput); |
274 onNotification(new Notification.fromJson(input)); | 274 onNotification(new Notification.fromJson(input)); |
275 } | 275 } |
276 } | 276 } |
277 }); | 277 }); |
278 return channelReady.future; | 278 return channelReady.future; |
279 } | 279 } |
280 | 280 |
281 @override | 281 @override |
282 void sendRequest(Request request) { | 282 void sendRequest(Request request) { |
283 Map<String, Object> json = request.toJson(); | 283 if (_sendPort != null) { |
284 String encodedRequest = JSON.encode(json); | 284 Map<String, Object> json = request.toJson(); |
285 instrumentationService.logPluginRequest(pluginId, encodedRequest); | 285 String encodedRequest = JSON.encode(json); |
286 _sendPort.send(json); | 286 instrumentationService.logPluginRequest(pluginId, encodedRequest); |
| 287 _sendPort.send(json); |
| 288 } |
287 } | 289 } |
288 | 290 |
289 /** | 291 /** |
290 * Spawn the isolate in which the plugin is running. | 292 * Spawn the isolate in which the plugin is running. |
291 */ | 293 */ |
292 Future<Isolate> _spawnIsolate(); | 294 Future<Isolate> _spawnIsolate(); |
293 } | 295 } |
OLD | NEW |