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

Side by Side Diff: pkg/analysis_server/lib/src/domain_analysis.dart

Issue 1776023002: Add AnalysisContext.onResultInvalidated(descriptor). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update Analysis Server. Created 4 years, 9 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 domain.analysis; 5 library domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analysis_server/plugin/analysis/analysis_domain.dart'; 10 import 'package:analysis_server/plugin/analysis/analysis_domain.dart';
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 } 356 }
357 } 357 }
358 358
359 /** 359 /**
360 * An implementation of [AnalysisDomain] for [AnalysisServer]. 360 * An implementation of [AnalysisDomain] for [AnalysisServer].
361 */ 361 */
362 class AnalysisDomainImpl implements AnalysisDomain { 362 class AnalysisDomainImpl implements AnalysisDomain {
363 final AnalysisServer server; 363 final AnalysisServer server;
364 364
365 final Map<ResultDescriptor, StreamController<engine.ComputedResult>> 365 final Map<ResultDescriptor, StreamController<engine.ResultChangedEvent>>
366 controllers = 366 controllers =
367 <ResultDescriptor, StreamController<engine.ComputedResult>>{}; 367 <ResultDescriptor, StreamController<engine.ResultChangedEvent>>{};
368 368
369 AnalysisDomainImpl(this.server) { 369 AnalysisDomainImpl(this.server) {
370 server.onContextsChanged.listen((ContextsChangedEvent event) { 370 server.onContextsChanged.listen((ContextsChangedEvent event) {
371 event.added.forEach(_subscribeForContext); 371 event.added.forEach(_subscribeForContext);
372 }); 372 });
373 } 373 }
374 374
375 @override 375 @override
376 Stream<engine.ComputedResult> onResultComputed(ResultDescriptor descriptor) { 376 Stream<engine.ResultChangedEvent> onResultChanged(
377 Stream<engine.ComputedResult> stream = controllers 377 ResultDescriptor descriptor) {
378 .putIfAbsent(descriptor, 378 Stream<engine.ResultChangedEvent> stream =
379 () => new StreamController<engine.ComputedResult>.broadcast()) 379 controllers.putIfAbsent(descriptor, () {
380 .stream; 380 return new StreamController<engine.ResultChangedEvent>.broadcast();
381 }).stream;
381 server.analysisContexts.forEach(_subscribeForContext); 382 server.analysisContexts.forEach(_subscribeForContext);
382 return stream; 383 return stream;
383 } 384 }
384 385
385 @override 386 @override
386 void scheduleNotification( 387 void scheduleNotification(
387 engine.AnalysisContext context, Source source, AnalysisService service) { 388 engine.AnalysisContext context, Source source, AnalysisService service) {
388 String file = source.fullName; 389 String file = source.fullName;
389 if (server.hasAnalysisSubscription(service, file)) { 390 if (server.hasAnalysisSubscription(service, file)) {
390 if (service == AnalysisService.NAVIGATION) { 391 if (service == AnalysisService.NAVIGATION) {
391 server.scheduleOperation(new NavigationOperation(context, source)); 392 server.scheduleOperation(new NavigationOperation(context, source));
392 } 393 }
393 if (service == AnalysisService.OCCURRENCES) { 394 if (service == AnalysisService.OCCURRENCES) {
394 server.scheduleOperation(new OccurrencesOperation(context, source)); 395 server.scheduleOperation(new OccurrencesOperation(context, source));
395 } 396 }
396 } 397 }
397 } 398 }
398 399
399 void _subscribeForContext(engine.AnalysisContext context) { 400 void _subscribeForContext(engine.AnalysisContext context) {
400 for (ResultDescriptor descriptor in controllers.keys) { 401 for (ResultDescriptor descriptor in controllers.keys) {
401 context.onResultComputed(descriptor).listen((result) { 402 context.onResultChanged(descriptor).listen((result) {
402 StreamController<engine.ComputedResult> controller = 403 StreamController<engine.ResultChangedEvent> controller =
403 controllers[result.descriptor]; 404 controllers[result.descriptor];
404 if (controller != null) { 405 if (controller != null) {
405 controller.add(result); 406 controller.add(result);
406 } 407 }
407 }); 408 });
408 } 409 }
409 } 410 }
410 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698