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

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

Issue 869793002: Move indexing into operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 Index index = server.index; 224 Index index = server.index;
225 if (index == null) { 225 if (index == null) {
226 return; 226 return;
227 } 227 }
228 for (ChangeNotice notice in notices) { 228 for (ChangeNotice notice in notices) {
229 // Dart 229 // Dart
230 if (notice.resolved) { 230 if (notice.resolved) {
231 try { 231 try {
232 CompilationUnit dartUnit = notice.compilationUnit; 232 CompilationUnit dartUnit = notice.compilationUnit;
233 if (dartUnit != null) { 233 if (dartUnit != null) {
234 index.indexUnit(context, dartUnit); 234 server.addOperation(new _DartIndexOperation(context, dartUnit));
235 } 235 }
236 } catch (exception, stackTrace) { 236 } catch (exception, stackTrace) {
237 server.sendServerErrorNotification(exception, stackTrace); 237 server.sendServerErrorNotification(exception, stackTrace);
238 } 238 }
239 // HTML 239 // HTML
240 try { 240 try {
241 HtmlUnit htmlUnit = notice.htmlUnit; 241 HtmlUnit htmlUnit = notice.htmlUnit;
242 if (htmlUnit != null) { 242 if (htmlUnit != null) {
243 index.indexHtmlUnit(context, htmlUnit); 243 server.addOperation(new _HtmlIndexOperation(context, htmlUnit));
244 } 244 }
245 } catch (exception, stackTrace) { 245 } catch (exception, stackTrace) {
246 server.sendServerErrorNotification(exception, stackTrace); 246 server.sendServerErrorNotification(exception, stackTrace);
247 } 247 }
248 } 248 }
249 } 249 }
250 } 250 }
251 } 251 }
252 252
253 253
254 class _DartHighlightsOperation extends _DartNotificationOperation { 254 class _DartHighlightsOperation extends _DartNotificationOperation {
255 _DartHighlightsOperation(String file, CompilationUnit unit) 255 _DartHighlightsOperation(String file, CompilationUnit unit)
256 : super(file, unit); 256 : super(file, unit);
257 257
258 @override 258 @override
259 void perform(AnalysisServer server) { 259 void perform(AnalysisServer server) {
260 print('+server _DartHighlightsOperation');
260 sendAnalysisNotificationHighlights(server, file, unit); 261 sendAnalysisNotificationHighlights(server, file, unit);
261 } 262 }
262 } 263 }
263 264
264 265
266 class _DartIndexOperation extends ServerOperation {
267 final AnalysisContext context;
268 final CompilationUnit unit;
269
270 _DartIndexOperation(this.context, this.unit);
271
272 @override
273 ServerOperationPriority get priority {
274 return ServerOperationPriority.ANALYSIS_INDEX;
275 }
276
277 @override
278 void perform(AnalysisServer server) {
279 print('+server _DartIndexOperation');
280 Index index = server.index;
281 index.indexUnit(context, unit);
282 }
283 }
284
285
265 class _DartNavigationOperation extends _DartNotificationOperation { 286 class _DartNavigationOperation extends _DartNotificationOperation {
266 _DartNavigationOperation(String file, CompilationUnit unit) 287 _DartNavigationOperation(String file, CompilationUnit unit)
267 : super(file, unit); 288 : super(file, unit);
268 289
269 @override 290 @override
270 void perform(AnalysisServer server) { 291 void perform(AnalysisServer server) {
271 sendAnalysisNotificationNavigation(server, file, unit); 292 sendAnalysisNotificationNavigation(server, file, unit);
272 } 293 }
273 } 294 }
274 295
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 _DartOverridesOperation(String file, CompilationUnit unit) 335 _DartOverridesOperation(String file, CompilationUnit unit)
315 : super(file, unit); 336 : super(file, unit);
316 337
317 @override 338 @override
318 void perform(AnalysisServer server) { 339 void perform(AnalysisServer server) {
319 sendAnalysisNotificationOverrides(server, file, unit); 340 sendAnalysisNotificationOverrides(server, file, unit);
320 } 341 }
321 } 342 }
322 343
323 344
345 class _HtmlIndexOperation extends ServerOperation {
346 final AnalysisContext context;
347 final HtmlUnit unit;
348
349 _HtmlIndexOperation(this.context, this.unit);
350
351 @override
352 ServerOperationPriority get priority {
353 return ServerOperationPriority.ANALYSIS_INDEX;
354 }
355
356 @override
357 void perform(AnalysisServer server) {
358 Index index = server.index;
359 index.indexHtmlUnit(context, unit);
360 }
361 }
362
363
324 class _NotificationErrorsOperation extends ServerOperation { 364 class _NotificationErrorsOperation extends ServerOperation {
325 final String file; 365 final String file;
326 final LineInfo lineInfo; 366 final LineInfo lineInfo;
327 final List<AnalysisError> errors; 367 final List<AnalysisError> errors;
328 368
329 _NotificationErrorsOperation(this.file, this.lineInfo, this.errors); 369 _NotificationErrorsOperation(this.file, this.lineInfo, this.errors);
330 370
331 @override 371 @override
332 ServerOperationPriority get priority { 372 ServerOperationPriority get priority {
333 return ServerOperationPriority.ANALYSIS_NOTIFICATION; 373 return ServerOperationPriority.ANALYSIS_NOTIFICATION;
334 } 374 }
335 375
336 @override 376 @override
337 void perform(AnalysisServer server) { 377 void perform(AnalysisServer server) {
338 sendAnalysisNotificationErrors(server, file, lineInfo, errors); 378 sendAnalysisNotificationErrors(server, file, lineInfo, errors);
339 } 379 }
340 } 380 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698