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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2708353008: Make it safe to initialize the notificationManager in server (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 24e1b53fe5561e79ac6b7a048016ab146242a126..ab74c030b2d6bc0d050d023221953283f70e9fb5 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -126,7 +126,7 @@ class AnalysisServer {
* The subset of notifications are those to which plugins may contribute.
* This field is `null` when the new plugin support is disabled.
*/
- final NotificationManager notificationManager = null;
+ final NotificationManager notificationManager;
/**
* The [ResourceProvider] using which paths are converted into [Resource]s.
@@ -374,7 +374,10 @@ class AnalysisServer {
ResolverProvider fileResolverProvider: null,
ResolverProvider packageResolverProvider: null,
bool useSingleContextManager: false,
- this.rethrowExceptions: true}) {
+ this.rethrowExceptions: true})
+ // TODO(brianwilkerson) Initialize notificationManager to
+ // "new NotificationManager(channel, resourceProvider)"
+ : notificationManager = null {
_performance = performanceDuringStartup;
defaultContextOptions.incremental = true;
defaultContextOptions.incrementalApi =
@@ -1235,6 +1238,9 @@ class AnalysisServer {
*/
void setAnalysisRoots(String requestId, List<String> includedPaths,
List<String> excludedPaths, Map<String, String> packageRoots) {
+ if (notificationManager != null) {
+ notificationManager.setAnalysisRoots(includedPaths, excludedPaths);
+ }
try {
contextManager.setRoots(includedPaths, excludedPaths, packageRoots);
} on UnimplementedError catch (e) {
@@ -1248,6 +1254,9 @@ class AnalysisServer {
*/
void setAnalysisSubscriptions(
Map<AnalysisService, Set<String>> subscriptions) {
+ if (notificationManager != null) {
+ notificationManager.setSubscriptions(subscriptions);
+ }
if (options.enableNewAnalysisDriver) {
this.analysisServices = subscriptions;
Iterable<nd.AnalysisDriver> drivers = driverMap.values;

Powered by Google App Engine
This is Rietveld 408576698