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

Unified Diff: pkg/analysis_server/lib/src/channel/byte_stream_channel.dart

Issue 951423002: Add more performance tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/channel/channel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
diff --git a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
index 884dcd25c0a3e1cd7c7386c7ea94e5af0e5efc2a..c03712fec40a6c09d2b11670d9c61843e5b3adec 100644
--- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
+++ b/pkg/analysis_server/lib/src/channel/byte_stream_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';
/**
* Instances of the class [ByteStreamClientChannel] implement a
@@ -120,11 +122,15 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closeRequested) {
return;
}
- ServerCommunicationChannel.ToJson.start();
- String jsonEncoding = JSON.encode(notification.toJson());
- ServerCommunicationChannel.ToJson.stop();
- _outputLine(jsonEncoding);
- _instrumentationService.logNotification(jsonEncoding);
+ PerformanceTag prevTag =
+ ServerPerformanceStatistics.serverChannel.makeCurrent();
+ try {
+ String jsonEncoding = JSON.encode(notification.toJson());
+ _outputLine(jsonEncoding);
+ _instrumentationService.logNotification(jsonEncoding);
+ } finally {
+ prevTag.makeCurrent();
+ }
Brian Wilkerson 2015/02/24 20:07:29 There's a lot of boiler-plate here. How about some
scheglov 2015/02/24 21:49:04 Will do in a separate CL.
}
@override
@@ -134,11 +140,15 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closeRequested) {
return;
}
- ServerCommunicationChannel.ToJson.start();
- String jsonEncoding = JSON.encode(response.toJson());
- ServerCommunicationChannel.ToJson.stop();
- _outputLine(jsonEncoding);
- _instrumentationService.logResponse(jsonEncoding);
+ PerformanceTag prevTag =
+ ServerPerformanceStatistics.serverChannel.makeCurrent();
+ try {
+ String jsonEncoding = JSON.encode(response.toJson());
+ _outputLine(jsonEncoding);
+ _instrumentationService.logResponse(jsonEncoding);
+ } finally {
+ prevTag.makeCurrent();
+ }
}
/**
@@ -157,16 +167,20 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closed.isCompleted) {
return;
}
- _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 {
+ _instrumentationService.logRequest(data);
+ // Parse the string as a JSON descriptor and process the resulting
+ // structure as a request.
+ Request request = new Request.fromString(data);
+ if (request == null) {
+ sendResponse(new Response.invalidRequestFormat());
+ return;
+ }
+ onRequest(request);
+ } finally {
+ prevTag.makeCurrent();
}
- onRequest(request);
}
}
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/channel/channel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698