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

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

Issue 1047733004: Support refresh of individual analysis roots (issue 22254) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address more comments Created 5 years, 8 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/doc/api.html ('k') | pkg/analysis_server/lib/src/context_manager.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 library analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' show max; 9 import 'dart:math' show max;
10 10
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 if (_onAnalysisCompleteCompleter != null) { 726 if (_onAnalysisCompleteCompleter != null) {
727 _onAnalysisCompleteCompleter.complete(); 727 _onAnalysisCompleteCompleter.complete();
728 _onAnalysisCompleteCompleter = null; 728 _onAnalysisCompleteCompleter = null;
729 } 729 }
730 ServerPerformanceStatistics.idle.makeCurrent(); 730 ServerPerformanceStatistics.idle.makeCurrent();
731 } 731 }
732 } 732 }
733 } 733 }
734 734
735 /** 735 /**
736 * Trigger reanalysis of all files from disk. 736 * Trigger reanalysis of all files in the given list of analysis [roots], or
737 * everything if the analysis roots is `null`.
737 */ 738 */
738 void reanalyze() { 739 void reanalyze(List<Resource> roots) {
739 // Clear any operations that are pending. 740 // Clear any operations that are pending.
740 operationQueue.clear(); 741 if (roots == null) {
742 operationQueue.clear();
743 } else {
744 for (AnalysisContext context in _getContexts(roots)) {
745 operationQueue.contextRemoved(context);
746 }
747 }
741 // Instruct the contextDirectoryManager to rebuild all contexts from 748 // Instruct the contextDirectoryManager to rebuild all contexts from
742 // scratch. 749 // scratch.
743 contextDirectoryManager.refresh(); 750 contextDirectoryManager.refresh(roots);
744 } 751 }
745 752
746 /** 753 /**
747 * Schedules execution of the given [ServerOperation]. 754 * Schedules execution of the given [ServerOperation].
748 */ 755 */
749 void scheduleOperation(ServerOperation operation) { 756 void scheduleOperation(ServerOperation operation) {
750 addOperation(operation); 757 addOperation(operation);
751 _schedulePerformOperation(); 758 _schedulePerformOperation();
752 } 759 }
753 760
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 // 1096 //
1090 // Update the defaults used to create new contexts. 1097 // Update the defaults used to create new contexts.
1091 // 1098 //
1092 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions; 1099 AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions;
1093 optionUpdaters.forEach((OptionUpdater optionUpdater) { 1100 optionUpdaters.forEach((OptionUpdater optionUpdater) {
1094 optionUpdater(options); 1101 optionUpdater(options);
1095 }); 1102 });
1096 } 1103 }
1097 1104
1098 /** 1105 /**
1106 * Return a set of contexts containing all of the resources in the given list
1107 * of [resources].
1108 */
1109 Set<AnalysisContext> _getContexts(List<Resource> resources) {
1110 Set<AnalysisContext> contexts = new HashSet<AnalysisContext>();
1111 resources.forEach((Resource resource) {
1112 if (resource is Folder) {
1113 contexts.addAll(contextDirectoryManager.contextsInAnalysisRoot(resource) );
1114 }
1115 });
1116 return contexts;
1117 }
1118
1119 /**
1099 * Returns the [CompilationUnit] of the Dart file with the given [source] that 1120 * Returns the [CompilationUnit] of the Dart file with the given [source] that
1100 * should be used to resend notifications for already resolved unit. 1121 * should be used to resend notifications for already resolved unit.
1101 * Returns `null` if the file is not a part of any context, library has not 1122 * Returns `null` if the file is not a part of any context, library has not
1102 * been yet resolved, or any problem happened. 1123 * been yet resolved, or any problem happened.
1103 */ 1124 */
1104 CompilationUnit _getResolvedCompilationUnitToResendNotification( 1125 CompilationUnit _getResolvedCompilationUnitToResendNotification(
1105 AnalysisContext context, Source source) { 1126 AnalysisContext context, Source source) {
1106 List<Source> librarySources = context.getLibrariesContaining(source); 1127 List<Source> librarySources = context.getLibrariesContaining(source);
1107 if (librarySources.isEmpty) { 1128 if (librarySources.isEmpty) {
1108 return null; 1129 return null;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 /** 1444 /**
1424 * The [PerformanceTag] for time spent in server request handlers. 1445 * The [PerformanceTag] for time spent in server request handlers.
1425 */ 1446 */
1426 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1447 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1427 1448
1428 /** 1449 /**
1429 * The [PerformanceTag] for time spent in split store microtasks. 1450 * The [PerformanceTag] for time spent in split store microtasks.
1430 */ 1451 */
1431 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1452 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1432 } 1453 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698