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

Unified Diff: base/task_scheduler/task_scheduler.h

Issue 2362253002: TaskScheduler: Add FlushForTesting(). (Closed)
Patch Set: Created 4 years, 3 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: base/task_scheduler/task_scheduler.h
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h
index 4000c7ab217d1aed89e617513cc78d6bd3488882..91a608ec746e65e2ebe85475ac377d0d845f4ba9 100644
--- a/base/task_scheduler/task_scheduler.h
+++ b/base/task_scheduler/task_scheduler.h
@@ -59,6 +59,13 @@ class BASE_EXPORT TaskScheduler {
// called once.
virtual void Shutdown() = 0;
+ // Waits until there are no pending undelayed tasks. May be called in tests
+ // to validate that a condition is met after all undelayed tasks have run.
+ //
+ // Does not wait for delayed tasks. Waits for undelayed tasks posted from
+ // other threads during the call. Returns immediately when shutdown completes.
+ virtual void FlushForTesting() = 0;
+
// CreateAndSetDefaultTaskScheduler() and SetInstance() register a
// TaskScheduler to handle tasks posted through the post_task.h API for this
// process. The registered TaskScheduler will only be deleted when a new

Powered by Google App Engine
This is Rietveld 408576698