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

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

Issue 2466713002: Make pumpEventQueue() private and explain why it is used in 'results'. (Closed)
Patch Set: Created 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b485d8557961b5eb4cbbfcb99d42f964737d2408..6489a452e6734452772742aafef569aaea71f4e5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -231,7 +231,17 @@ class AnalysisDriver {
try {
PerformanceLogSection analysisSection = null;
while (true) {
- await pumpEventQueue(100);
+ // Pump the event queue to allow IO and other asynchronous data
+ // processing while analysis is active. For example Analysis Server
+ // need to be able to process update content or set priority requests
Brian Wilkerson 2016/10/31 20:41:04 "need" --> "needs" "update content" --> "updateCon
scheglov 2016/10/31 20:48:14 Done.
+ // while background analysis is in progress.
+ //
+ // The number of pumpings is arbitrary, might be changed if we see that
+ // analysis or other data processing tasks are starving. Ideally we
+ // would need to be able to set priority of (continuous) asynchronous
+ // tasks.
+ await _pumpEventQueue(128);
Florian Schneider 2016/10/31 20:41:01 dbc: This seems arbitrary. Why not wait on the com
scheglov 2016/10/31 20:48:14 Yes, the number is arbitrary. The question does n
Florian Schneider 2016/10/31 22:16:50 What happens if this number is too low, or too hig
Paul Berry 2016/10/31 22:40:33 Unfortunately this is a different situation from t
+
await _hasWork.signal;
if (analysisSection == null) {
@@ -377,20 +387,6 @@ class AnalysisDriver {
}
/**
- * Returns a [Future] that completes after pumping the event queue [times]
- * times. By default, this should pump the event queue enough times to allow
- * any code to run, as long as it's not waiting on some external event.
- */
- Future pumpEventQueue([int times = 5000]) {
- if (times == 0) return new Future.value();
- // We use a delayed future to allow microtask events to finish. The
- // Future.value or Future() constructors use scheduleMicrotask themselves and
- // would therefore not wait for microtask callbacks that are scheduled after
- // invoking this method.
- return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
- }
-
- /**
* Remove the file with the given [path] from the list of files to analyze.
*
* The [path] must be absolute and normalized.
@@ -725,6 +721,17 @@ class AnalysisDriver {
}
/**
+ * Returns a [Future] that completes after performing [times] pumpings of
+ * the event queue.
+ */
+ static Future _pumpEventQueue(int times) {
+ if (times == 0) {
+ return new Future.value();
+ }
+ return new Future.delayed(Duration.ZERO, () => _pumpEventQueue(times - 1));
+ }
+
+ /**
* Remove and return the first item in the given [set].
*/
static Object/*=T*/ _removeFirst/*<T>*/(LinkedHashSet<Object/*=T*/ > set) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698