| Index: pkg/analysis_server/lib/src/channel/web_socket_channel.dart
|
| diff --git a/pkg/analysis_server/lib/src/channel/web_socket_channel.dart b/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
|
| index b8ddf6d586e556bcdaf51d314611680ff5079731..e70bd005aafde78a842ef649e0088bef2912a784 100644
|
| --- a/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
|
| +++ b/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
|
| @@ -8,9 +8,11 @@ import 'dart:async';
|
| import 'dart:convert';
|
| import 'dart:io';
|
|
|
| +import 'package:analysis_server/src/analysis_server.dart';
|
| import 'package:analysis_server/src/channel/channel.dart';
|
| import 'package:analysis_server/src/protocol.dart';
|
| import 'package:analyzer/instrumentation/instrumentation.dart';
|
| +import 'package:analyzer/src/generated/utilities_general.dart';
|
|
|
|
|
| /**
|
| @@ -105,14 +107,18 @@ class WebSocketServerChannel implements ServerCommunicationChannel {
|
| instrumentationService.logRequest(data);
|
| // Parse the string as a JSON descriptor and process the resulting
|
| // structure as a request.
|
| - ServerCommunicationChannel.FromJson.start();
|
| - Request request = new Request.fromString(data);
|
| - ServerCommunicationChannel.FromJson.stop();
|
| - if (request == null) {
|
| - sendResponse(new Response.invalidRequestFormat());
|
| - return;
|
| + PerformanceTag prevTag =
|
| + ServerPerformanceStatistics.serverChannel.makeCurrent();
|
| + try {
|
| + Request request = new Request.fromString(data);
|
| + if (request == null) {
|
| + sendResponse(new Response.invalidRequestFormat());
|
| + return;
|
| + }
|
| + onRequest(request);
|
| + } finally {
|
| + prevTag.makeCurrent();
|
| }
|
| - onRequest(request);
|
| } else if (data is List<int>) {
|
| // TODO(brianwilkerson) Implement a more efficient protocol.
|
| sendResponse(new Response.invalidRequestFormat());
|
| @@ -123,19 +129,27 @@ class WebSocketServerChannel implements ServerCommunicationChannel {
|
|
|
| @override
|
| void sendNotification(Notification notification) {
|
| - ServerCommunicationChannel.ToJson.start();
|
| - String jsonEncoding = JSON.encode(notification.toJson());
|
| - ServerCommunicationChannel.ToJson.stop();
|
| - socket.add(jsonEncoding);
|
| - instrumentationService.logNotification(jsonEncoding);
|
| + PerformanceTag prevTag =
|
| + ServerPerformanceStatistics.serverChannel.makeCurrent();
|
| + try {
|
| + String jsonEncoding = JSON.encode(notification.toJson());
|
| + socket.add(jsonEncoding);
|
| + instrumentationService.logNotification(jsonEncoding);
|
| + } finally {
|
| + prevTag.makeCurrent();
|
| + }
|
| }
|
|
|
| @override
|
| void sendResponse(Response response) {
|
| - ServerCommunicationChannel.ToJson.start();
|
| - String jsonEncoding = JSON.encode(response.toJson());
|
| - ServerCommunicationChannel.ToJson.stop();
|
| - socket.add(jsonEncoding);
|
| - instrumentationService.logResponse(jsonEncoding);
|
| + PerformanceTag prevTag =
|
| + ServerPerformanceStatistics.serverChannel.makeCurrent();
|
| + try {
|
| + String jsonEncoding = JSON.encode(response.toJson());
|
| + socket.add(jsonEncoding);
|
| + instrumentationService.logResponse(jsonEncoding);
|
| + } finally {
|
| + prevTag.makeCurrent();
|
| + }
|
| }
|
| }
|
|
|