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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2857233002: Implement more of the behavior of a plugin; refactor some API (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index f25bd273ee61e9a450d5d25ee109b25b8e829b26..1f4742b7d627b51a8eb86974bdda8ecc05056933 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -320,9 +320,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
*/
FileSystemState get fsState => _fsState;
- /**
- * Return `true` if the driver has a file to analyze.
- */
+ @override
bool get hasFilesToAnalyze {
return _fileTracker.hasChangedFiles ||
_requestedFiles.isNotEmpty ||
@@ -353,15 +351,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
*/
List<String> get priorityFiles => _priorityFiles.toList(growable: false);
- /**
- * Set the list of files that the driver should try to analyze sooner.
- *
- * Every path in the list must be absolute and normalized.
- *
- * The driver will produce the results through the [results] stream. The
- * exact order in which results are produced is not defined, neither
- * between priority files, nor between priority and non-priority files.
- */
+ @override
void set priorityFiles(List<String> priorityPaths) {
_priorityResults.keys
.toSet()
@@ -410,9 +400,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
@visibleForTesting
AnalysisDriverTestView get test => _testView;
- /**
- * Return the priority of work that the driver needs to perform.
- */
+ @override
AnalysisDriverPriority get workPriority {
if (_requestedFiles.isNotEmpty) {
return AnalysisDriverPriority.interactive;
@@ -521,11 +509,9 @@ class AnalysisDriver implements AnalysisDriverGeneric {
_fileTracker.addFiles(addedFiles);
}
- /**
- * Notify the driver that the client is going to stop using it.
- */
+ @override
void dispose() {
- _scheduler._remove(this);
+ _scheduler.remove(this);
}
/**
@@ -753,9 +739,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
unit.lineInfo, unit, listener.errors);
}
- /**
- * Perform a single chunk of work and produce [results].
- */
+ @override
Future<Null> performWork() async {
if (_fileTracker.verifyChangedFilesIfNeeded()) {
return;
@@ -1348,11 +1332,27 @@ abstract class AnalysisDriverGeneric {
bool get hasFilesToAnalyze;
/**
+ * Set the list of files that the driver should try to analyze sooner.
+ *
+ * Every path in the list must be absolute and normalized.
+ *
+ * The driver will produce the results through the [results] stream. The
+ * exact order in which results are produced is not defined, neither
+ * between priority files, nor between priority and non-priority files.
+ */
+ void set priorityFiles(List<String> priorityPaths);
+
+ /**
* Return the priority of work that the driver needs to perform.
*/
AnalysisDriverPriority get workPriority;
/**
+ * Notify the driver that the client is going to stop using it.
+ */
+ void dispose();
+
+ /**
* Perform a single chunk of work and produce [results].
*/
Future<Null> performWork();
@@ -1458,6 +1458,18 @@ class AnalysisDriverScheduler {
}
/**
+ * Remove the given [driver] from the scheduler, so that it will not be
+ * asked to perform any new work.
+ */
+ void remove(AnalysisDriverGeneric driver) {
+ if (driver is AnalysisDriver) {
+ driverWatcher?.removedDriver(driver);
+ }
+ _drivers.remove(driver);
+ _hasWork.notify();
+ }
+
+ /**
* Start the scheduler, so that any [AnalysisDriver] created before or
* after will be asked to perform work.
*/
@@ -1478,19 +1490,6 @@ class AnalysisDriverScheduler {
Future<Null> waitForIdle() => _statusSupport.waitForIdle();
/**
- * Remove the given [driver] from the scheduler, so that it will not be
- * asked to perform any new work.
- */
- void _remove(AnalysisDriverGeneric driver) {
- if (driver is AnalysisDriver) {
- driverWatcher?.removedDriver(driver);
- }
-
- _drivers.remove(driver);
- _hasWork.notify();
- }
-
- /**
* Run infinitely analysis cycle, selecting the drivers with the highest
* priority first.
*/
« no previous file with comments | « no previous file | pkg/analyzer_plugin/lib/plugin/plugin.dart » ('j') | pkg/analyzer_plugin/test/plugin/plugin_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698