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

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

Issue 1327173002: Make NavigationOperation a MergeableOperation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
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_highlights2.dart'; 9 import 'package:analysis_server/src/computer/computer_highlights2.dart';
10 import 'package:analysis_server/src/computer/computer_occurrences.dart'; 10 import 'package:analysis_server/src/computer/computer_occurrences.dart';
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void _sendNotification(AnalysisServer server, f()) { 222 void _sendNotification(AnalysisServer server, f()) {
223 ServerPerformanceStatistics.notices.makeCurrentWhile(() { 223 ServerPerformanceStatistics.notices.makeCurrentWhile(() {
224 try { 224 try {
225 f(); 225 f();
226 } catch (exception, stackTrace) { 226 } catch (exception, stackTrace) {
227 server.sendServerErrorNotification(exception, stackTrace); 227 server.sendServerErrorNotification(exception, stackTrace);
228 } 228 }
229 }); 229 });
230 } 230 }
231 231
232 class NavigationOperation extends _NotificationOperation { 232 class NavigationOperation extends _NotificationOperation
233 implements MergeableOperation {
233 NavigationOperation(AnalysisContext context, Source source) 234 NavigationOperation(AnalysisContext context, Source source)
234 : super(context, source); 235 : super(context, source);
235 236
236 @override 237 @override
237 void perform(AnalysisServer server) { 238 void perform(AnalysisServer server) {
238 sendAnalysisNotificationNavigation(server, context, source); 239 sendAnalysisNotificationNavigation(server, context, source);
239 } 240 }
241
242 @override
243 bool merge(ServerOperation other) {
244 return other is NavigationOperation &&
245 other.context == context &&
246 other.source == source;
247 }
240 } 248 }
241 249
242 /** 250 /**
243 * Instances of [PerformAnalysisOperation] perform a single analysis task. 251 * Instances of [PerformAnalysisOperation] perform a single analysis task.
244 */ 252 */
245 class PerformAnalysisOperation extends ServerOperation { 253 class PerformAnalysisOperation extends ServerOperation {
246 static const int IDLE_CACHE_SIZE = AnalysisOptionsImpl.DEFAULT_CACHE_SIZE; 254 static const int IDLE_CACHE_SIZE = AnalysisOptionsImpl.DEFAULT_CACHE_SIZE;
247 static const int WORKING_CACHE_SIZE = 512; 255 static const int WORKING_CACHE_SIZE = 512;
248 256
249 final bool isContinue; 257 final bool isContinue;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 abstract class _SingleFileOperation extends SourceSensitiveOperation { 501 abstract class _SingleFileOperation extends SourceSensitiveOperation {
494 final String file; 502 final String file;
495 503
496 _SingleFileOperation(AnalysisContext context, this.file) : super(context); 504 _SingleFileOperation(AnalysisContext context, this.file) : super(context);
497 505
498 @override 506 @override
499 bool shouldBeDiscardedOnSourceChange(Source source) { 507 bool shouldBeDiscardedOnSourceChange(Source source) {
500 return source.fullName == file; 508 return source.fullName == file;
501 } 509 }
502 } 510 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation.dart ('k') | pkg/analysis_server/lib/src/operation/operation_queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698