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

Unified Diff: base/task_scheduler/test_task_factory.h

Issue 1701343003: TaskScheduler [13] TaskSchedulerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s_6_threadpool
Patch Set: initial patch for review Created 4 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: base/task_scheduler/test_task_factory.h
diff --git a/base/task_scheduler/test_task_factory.h b/base/task_scheduler/test_task_factory.h
index 9a11882209b20ae559197b4e638b6692f23490cf..4eac8dc55044eab44cc2ab5f92868aa90805f6e7 100644
--- a/base/task_scheduler/test_task_factory.h
+++ b/base/task_scheduler/test_task_factory.h
@@ -9,6 +9,7 @@
#include <unordered_set>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/condition_variable.h"
@@ -26,6 +27,8 @@ namespace test {
// A TestTaskFactory posts tasks to a TaskRunner and verifies that they run as
// expected. Generates a test failure when:
+// - The RunsTasksOnCurrentThread() method of the TaskRunner returns false on a
+// thread on which a Task is run.
// - The ExecutionMode of the TaskRunner is SEQUENCED or SINGLE_THREADED and
// Tasks don't run in posting order.
// - The ExecutionMode of the TaskRunner is SINGLE_THREADED and Tasks don't
@@ -45,10 +48,11 @@ class TestTaskFactory {
~TestTaskFactory();
- // Posts a task. If |post_nested_task| is YES, the task will post a new task
- // when it runs. If |event| is set, the task will block until it is signaled.
- // Returns true if the task is posted.
- bool PostTask(PostNestedTask post_nested_task, WaitableEvent* event);
+ // Posts a task. The posted task will:
+ // - Post a new task if |post_nested_task| is YES.
+ // - Verify conditions in which the task runs (see potential failures above).
+ // - Run |closure| if it is not null.
+ bool PostTask(PostNestedTask post_nested_task, const Closure& closure);
// Waits for all tasks posted by PostTask() to start running. It is not
// guaranteed that the tasks have completed their execution when this returns.
@@ -59,7 +63,7 @@ class TestTaskFactory {
private:
void RunTaskCallback(size_t task_index,
PostNestedTask post_nested_task,
- WaitableEvent* event);
+ const Closure& closure);
// Synchronizes access to all members.
mutable Lock lock_;

Powered by Google App Engine
This is Rietveld 408576698