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

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 887793003: Avoid redundant notifications when a file is analyzed in multiple contexts. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library operation.analysis; 5 library operation.analysis;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; 8 import 'package:analysis_server/src/computer/computer_highlights.dart';
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; 9 import 'package:analysis_server/src/computer/computer_navigation.dart';
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; 10 import 'package:analysis_server/src/computer/computer_occurrences.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 /** 168 /**
169 * Send the information in the given list of notices back to the client. 169 * Send the information in the given list of notices back to the client.
170 */ 170 */
171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) { 171 void _sendNotices(AnalysisServer server, List<ChangeNotice> notices) {
172 for (int i = 0; i < notices.length; i++) { 172 for (int i = 0; i < notices.length; i++) {
173 ChangeNotice notice = notices[i]; 173 ChangeNotice notice = notices[i];
174 Source source = notice.source; 174 Source source = notice.source;
175 String file = source.fullName; 175 String file = source.fullName;
176 // Only send notifications if the current context is the preferred
177 // context for the file. This avoids redundant notification messages
178 // being sent to the client (see dartbug.com/22210).
179 // TODO(paulberry): note that there is a small risk that this will cause
180 // notifications to be lost if the preferred context for a file changes
181 // while analysis is in progress (e.g. because the client sent an
182 // analysis.setAnalysisRoots message).
183 if (server.getAnalysisContext(file) != context) {
184 continue;
185 }
176 // Dart 186 // Dart
177 CompilationUnit parsedDartUnit = notice.parsedDartUnit; 187 CompilationUnit parsedDartUnit = notice.parsedDartUnit;
178 CompilationUnit resolvedDartUnit = notice.resolvedDartUnit; 188 CompilationUnit resolvedDartUnit = notice.resolvedDartUnit;
179 CompilationUnit dartUnit = 189 CompilationUnit dartUnit =
180 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit; 190 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit;
181 if (resolvedDartUnit != null) { 191 if (resolvedDartUnit != null) {
182 if (server.hasAnalysisSubscription( 192 if (server.hasAnalysisSubscription(
183 protocol.AnalysisService.HIGHLIGHTS, 193 protocol.AnalysisService.HIGHLIGHTS,
184 file)) { 194 file)) {
185 server.addOperation( 195 server.addOperation(
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 @override 387 @override
378 ServerOperationPriority get priority { 388 ServerOperationPriority get priority {
379 return ServerOperationPriority.ANALYSIS_NOTIFICATION; 389 return ServerOperationPriority.ANALYSIS_NOTIFICATION;
380 } 390 }
381 391
382 @override 392 @override
383 void perform(AnalysisServer server) { 393 void perform(AnalysisServer server) {
384 sendAnalysisNotificationErrors(server, file, lineInfo, errors); 394 sendAnalysisNotificationErrors(server, file, lineInfo, errors);
385 } 395 }
386 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698