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

Unified Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 956623006: Merge notifications computing into the 'notices' tag. (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 | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/operation/operation_analysis.dart
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index cfab1d61bf24521556d38265c5f66eaf9859e5c0..4ed7609da911865f6f7ca37c153fab9fa8df9f3b 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -84,7 +84,7 @@ void scheduleNotificationOperations(AnalysisServer server, String file,
void sendAnalysisNotificationErrors(AnalysisServer server, String file,
LineInfo lineInfo, List<AnalysisError> errors) {
- try {
+ _sendNotification(server, () {
if (errors == null) {
errors = <AnalysisError>[];
}
@@ -92,27 +92,22 @@ void sendAnalysisNotificationErrors(AnalysisServer server, String file,
protocol.doAnalysisError_listFromEngine(lineInfo, errors);
var params = new protocol.AnalysisErrorsParams(file, serverErrors);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
}
-
void sendAnalysisNotificationHighlights(AnalysisServer server, String file,
CompilationUnit dartUnit) {
- try {
+ _sendNotification(server, () {
var regions = new DartUnitHighlightsComputer(dartUnit).compute();
var params = new protocol.AnalysisHighlightsParams(file, regions);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
}
void sendAnalysisNotificationNavigation(AnalysisServer server, String file,
CompilationUnit dartUnit) {
- try {
+ _sendNotification(server, () {
var computer = new DartUnitNavigationComputer(dartUnit);
computer.compute();
var params = new protocol.AnalysisNavigationParams(
@@ -121,46 +116,52 @@ void sendAnalysisNotificationNavigation(AnalysisServer server, String file,
computer.targets,
computer.files);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
}
void sendAnalysisNotificationOccurrences(AnalysisServer server, String file,
CompilationUnit dartUnit) {
- try {
+ _sendNotification(server, () {
var occurrences = new DartUnitOccurrencesComputer(dartUnit).compute();
var params = new protocol.AnalysisOccurrencesParams(file, occurrences);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
}
void sendAnalysisNotificationOutline(AnalysisServer server, String file,
LineInfo lineInfo, CompilationUnit dartUnit) {
- try {
+ _sendNotification(server, () {
var computer = new DartUnitOutlineComputer(file, lineInfo, dartUnit);
var outline = computer.compute();
var params = new protocol.AnalysisOutlineParams(file, outline);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
}
void sendAnalysisNotificationOverrides(AnalysisServer server, String file,
CompilationUnit dartUnit) {
- try {
+ _sendNotification(server, () {
var overrides = new DartUnitOverridesComputer(dartUnit).compute();
var params = new protocol.AnalysisOverridesParams(file, overrides);
server.sendNotification(params.toNotification());
- } catch (exception, stackTrace) {
- server.sendServerErrorNotification(exception, stackTrace);
- }
+ });
+}
+
+
+/**
+ * Runs the given notification producing function [f], catching exceptions.
+ */
+void _sendNotification(AnalysisServer server, f()) {
+ ServerPerformanceStatistics.notices.makeCurrentWhile(() {
+ try {
+ f();
+ } catch (exception, stackTrace) {
+ server.sendServerErrorNotification(exception, stackTrace);
+ }
+ });
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698