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

Side by Side Diff: pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart

Issue 2893803004: Capture the request time for performance data and support forced shutdown (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 @override 217 @override
218 void close() { 218 void close() {
219 _receivePort?.close(); 219 _receivePort?.close();
220 _errorPort?.close(); 220 _errorPort?.close();
221 _exitPort?.close(); 221 _exitPort?.close();
222 _isolate = null; 222 _isolate = null;
223 } 223 }
224 224
225 @override 225 @override
226 void kill() {
227 _isolate.kill(priority: Isolate.IMMEDIATE);
228 }
229
230 @override
226 Future<Null> listen(void onResponse(Response response), 231 Future<Null> listen(void onResponse(Response response),
227 void onNotification(Notification notification), 232 void onNotification(Notification notification),
228 {Function onError, void onDone()}) async { 233 {Function onError, void onDone()}) async {
229 if (_isolate != null) { 234 if (_isolate != null) {
230 throw new StateError('Cannot listen to the same channel more than once.'); 235 throw new StateError('Cannot listen to the same channel more than once.');
231 } 236 }
232 _receivePort = new ReceivePort(); 237 _receivePort = new ReceivePort();
233 if (onError != null) { 238 if (onError != null) {
234 _errorPort = new ReceivePort(); 239 _errorPort = new ReceivePort();
235 _errorPort.listen((error) { 240 _errorPort.listen((error) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 String encodedRequest = JSON.encode(json); 287 String encodedRequest = JSON.encode(json);
283 instrumentationService.logPluginRequest(pluginId, encodedRequest); 288 instrumentationService.logPluginRequest(pluginId, encodedRequest);
284 _sendPort.send(json); 289 _sendPort.send(json);
285 } 290 }
286 291
287 /** 292 /**
288 * Spawn the isolate in which the plugin is running. 293 * Spawn the isolate in which the plugin is running.
289 */ 294 */
290 Future<Isolate> _spawnIsolate(); 295 Future<Isolate> _spawnIsolate();
291 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698