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

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

Issue 954013002: Replace try/finally with PerformanceTag.makeCurrentWhile(). (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
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 c03712fec40a6c09d2b11670d9c61843e5b3adec..14d7268163b0a8f6d85cb4067fd2555d4fa2c3b8 100644
--- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
+++ b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
@@ -12,7 +12,6 @@ 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
@@ -122,15 +121,11 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closeRequested) {
return;
}
- PerformanceTag prevTag =
- ServerPerformanceStatistics.serverChannel.makeCurrent();
- try {
+ ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
String jsonEncoding = JSON.encode(notification.toJson());
_outputLine(jsonEncoding);
_instrumentationService.logNotification(jsonEncoding);
- } finally {
- prevTag.makeCurrent();
- }
+ });
}
@override
@@ -140,15 +135,11 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closeRequested) {
return;
}
- PerformanceTag prevTag =
- ServerPerformanceStatistics.serverChannel.makeCurrent();
- try {
+ ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
String jsonEncoding = JSON.encode(response.toJson());
_outputLine(jsonEncoding);
_instrumentationService.logResponse(jsonEncoding);
- } finally {
- prevTag.makeCurrent();
- }
+ });
}
/**
@@ -167,9 +158,7 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
if (_closed.isCompleted) {
return;
}
- PerformanceTag prevTag =
- ServerPerformanceStatistics.serverChannel.makeCurrent();
- try {
+ ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
_instrumentationService.logRequest(data);
// Parse the string as a JSON descriptor and process the resulting
// structure as a request.
@@ -179,8 +168,6 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
return;
}
onRequest(request);
- } finally {
- prevTag.makeCurrent();
- }
+ });
}
}

Powered by Google App Engine
This is Rietveld 408576698