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

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

Issue 1741663003: Remove more methods from context manager callbacks (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | 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 3224a205bcd018570c34e011984c0ef6f484b410..0226b7c561a0676dadc9e034f8901ee0318299c7 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -250,6 +250,13 @@ abstract class ContextManager {
List<String> get includedPaths;
/**
+ * The stream that is notified when we are starting or ending the computation
+ * of a package map. A value of `true` is added when the computation starts
+ * and a value of `false` is added when the computation ends.
+ */
+ Stream<bool> get onComputingPackageMap;
+
+ /**
* Return a list of all of the contexts reachable from the given
* [analysisRoot] (the context associated with [analysisRoot] and all of its
* descendants).
@@ -322,21 +329,6 @@ abstract class ContextManagerCallbacks {
void applyChangesToContext(Folder contextFolder, ChangeSet changeSet);
/**
- * Called when the ContextManager is about to start computing the package
- * map.
- */
- void beginComputePackageMap() {
- // By default, do nothing.
- }
-
- /**
- * Called when the ContextManager has finished computing the package map.
- */
- void endComputePackageMap() {
- // By default, do nothing.
- }
-
- /**
* Remove the context associated with the given [folder]. [flushedFiles] is
* a list of the files which will be "orphaned" by removing this context
* (they will no longer be analyzed by any context).
@@ -469,6 +461,12 @@ class ContextManagerImpl implements ContextManager {
final ContextInfo rootInfo = new ContextInfo._root();
/**
+ * The controller that is notified when we are starting or ending the
+ * computation of a package map.
+ */
+ StreamController<bool> _onComputingPackageMapController;
+
+ /**
* Stream subscription we are using to watch each analysis root directory for
* changes.
*/
@@ -484,6 +482,12 @@ class ContextManagerImpl implements ContextManager {
this.defaultContextOptions) {
absolutePathContext = resourceProvider.absolutePathContext;
pathContext = resourceProvider.pathContext;
+ _onComputingPackageMapController = new StreamController.broadcast();
+ }
+
+ @override
+ Stream<bool> get onComputingPackageMap {
+ return _onComputingPackageMapController.stream;
}
@override
@@ -994,7 +998,7 @@ class ContextManagerImpl implements ContextManager {
return new NoPackageFolderDisposition(packageRoot: packageRoot);
} else {
PackageMapInfo packageMapInfo;
- callbacks.beginComputePackageMap();
+ _onComputingPackageMapController.add(true);
try {
// Try .packages first.
if (absolutePathContext.basename(packagespecFile.path) ==
@@ -1013,7 +1017,7 @@ class ContextManagerImpl implements ContextManager {
packageMapInfo = _packageMapProvider.computePackageMap(folder);
});
} finally {
- callbacks.endComputePackageMap();
+ _onComputingPackageMapController.add(false);
}
for (String dependencyPath in packageMapInfo.dependencies) {
addDependency(dependencyPath);
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698