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

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

Issue 1447603004: Fix for the watcher leak. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 7bce28518867543ab825752d55f1db34a16aec2c..d58a392acfe40e36632180c4e8a63485fe16420d 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -404,7 +404,7 @@ class ContextManagerImpl implements ContextManager {
* Stream subscription we are using to watch each analysis root directory for
* changes.
*/
- final Map<Folder, StreamSubscription<WatchEvent>> _changeSubscriptions =
+ final Map<Folder, StreamSubscription<WatchEvent>> changeSubscriptions =
<Folder, StreamSubscription<WatchEvent>>{};
ContextManagerImpl(this.resourceProvider, this.packageResolverProvider,
@@ -601,7 +601,7 @@ class ContextManagerImpl implements ContextManager {
return info.folder.isOrContains(includedFolder.path);
});
if (!wasIncluded) {
- _changeSubscriptions[includedFolder] =
+ changeSubscriptions[includedFolder] =
includedFolder.changes.listen(_handleWatchEvent);
_createContexts(_rootInfo, includedFolder, false);
}
@@ -935,9 +935,7 @@ class ContextManagerImpl implements ContextManager {
* Clean up and destroy the context associated with the given folder.
*/
void _destroyContext(ContextInfo info) {
- if (_changeSubscriptions.containsKey(info.folder)) {
- _changeSubscriptions[info.folder].cancel();
- }
+ changeSubscriptions.remove(info.folder)?.cancel();
callbacks.removeContext(info.folder, _computeFlushedFiles(info));
bool wasRemoved = info.parent.children.remove(info);
assert(wasRemoved);
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698