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

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

Issue 2989633002: Issue 30238. Fix for subscribing for a notifications with already cached analysis result. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_outline_test.dart » ('j') | 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:core'; 7 import 'dart:core';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return driver; 553 return driver;
554 } 554 }
555 return null; 555 return null;
556 } 556 }
557 557
558 /** 558 /**
559 * Return the analysis result for the file with the given [path]. The file is 559 * Return the analysis result for the file with the given [path]. The file is
560 * analyzed in one of the analysis drivers to which the file was added, 560 * analyzed in one of the analysis drivers to which the file was added,
561 * otherwise in the first driver, otherwise `null` is returned. 561 * otherwise in the first driver, otherwise `null` is returned.
562 */ 562 */
563 Future<nd.AnalysisResult> getAnalysisResult(String path) async { 563 Future<nd.AnalysisResult> getAnalysisResult(String path,
564 {bool sendCachedToStream: false}) async {
564 if (!AnalysisEngine.isDartFileName(path)) { 565 if (!AnalysisEngine.isDartFileName(path)) {
565 return null; 566 return null;
566 } 567 }
567 568
568 try { 569 try {
569 nd.AnalysisDriver driver = getAnalysisDriver(path); 570 nd.AnalysisDriver driver = getAnalysisDriver(path);
570 return await driver?.getResult(path); 571 return await driver?.getResult(path,
572 sendCachedToStream: sendCachedToStream);
571 } catch (e) { 573 } catch (e) {
572 // Ignore the exception. 574 // Ignore the exception.
573 // We don't want to log the same exception again and again. 575 // We don't want to log the same exception again and again.
574 return null; 576 return null;
575 } 577 }
576 } 578 }
577 579
578 /** 580 /**
579 * Return the [AstProvider] for the given [path]. 581 * Return the [AstProvider] for the given [path].
580 */ 582 */
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 notificationManager.setSubscriptions(subscriptions); 866 notificationManager.setSubscriptions(subscriptions);
865 } 867 }
866 this.analysisServices = subscriptions; 868 this.analysisServices = subscriptions;
867 Set<String> allNewFiles = 869 Set<String> allNewFiles =
868 subscriptions.values.expand((files) => files).toSet(); 870 subscriptions.values.expand((files) => files).toSet();
869 for (String file in allNewFiles) { 871 for (String file in allNewFiles) {
870 // The result will be produced by the "results" stream with 872 // The result will be produced by the "results" stream with
871 // the fully resolved unit, and processed with sending analysis 873 // the fully resolved unit, and processed with sending analysis
872 // notifications as it happens after content changes. 874 // notifications as it happens after content changes.
873 if (AnalysisEngine.isDartFileName(file)) { 875 if (AnalysisEngine.isDartFileName(file)) {
874 getAnalysisResult(file); 876 getAnalysisResult(file, sendCachedToStream: true);
875 } 877 }
876 } 878 }
877 } 879 }
878 880
879 /** 881 /**
880 * Implementation for `analysis.setGeneralSubscriptions`. 882 * Implementation for `analysis.setGeneralSubscriptions`.
881 */ 883 */
882 void setGeneralAnalysisSubscriptions( 884 void setGeneralAnalysisSubscriptions(
883 List<GeneralAnalysisService> subscriptions) { 885 List<GeneralAnalysisService> subscriptions) {
884 Set<GeneralAnalysisService> newServices = subscriptions.toSet(); 886 Set<GeneralAnalysisService> newServices = subscriptions.toSet();
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 /** 1496 /**
1495 * The [PerformanceTag] for time spent in server request handlers. 1497 * The [PerformanceTag] for time spent in server request handlers.
1496 */ 1498 */
1497 static PerformanceTag serverRequests = server.createChild('requests'); 1499 static PerformanceTag serverRequests = server.createChild('requests');
1498 1500
1499 /** 1501 /**
1500 * The [PerformanceTag] for time spent in split store microtasks. 1502 * The [PerformanceTag] for time spent in split store microtasks.
1501 */ 1503 */
1502 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1504 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1503 } 1505 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_outline_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698