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

Unified Diff: base/task_scheduler/test_task_factory.cc

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.cc
diff --git a/base/task_scheduler/test_task_factory.cc b/base/task_scheduler/test_task_factory.cc
index 5edf3dda17a16ed39b26e0ac71b1be1781c6592c..949195dd39542e80cdb1bcbe0a53087a83018d45 100644
--- a/base/task_scheduler/test_task_factory.cc
+++ b/base/task_scheduler/test_task_factory.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/synchronization/waitable_event.h"
@@ -30,12 +31,11 @@ TestTaskFactory::~TestTaskFactory() {
}
bool TestTaskFactory::PostTask(PostNestedTask post_nested_task,
- WaitableEvent* event) {
+ const Closure& closure) {
AutoLock auto_lock(lock_);
return task_runner_->PostTask(
- FROM_HERE,
- Bind(&TestTaskFactory::RunTaskCallback, Unretained(this),
- num_posted_tasks_++, post_nested_task, Unretained(event)));
+ FROM_HERE, Bind(&TestTaskFactory::RunTaskCallback, Unretained(this),
+ num_posted_tasks_++, post_nested_task, closure));
}
void TestTaskFactory::WaitForAllTasksToRun() const {
@@ -46,9 +46,9 @@ void TestTaskFactory::WaitForAllTasksToRun() const {
void TestTaskFactory::RunTaskCallback(size_t task_index,
PostNestedTask post_nested_task,
- WaitableEvent* event) {
+ const Closure& closure) {
if (post_nested_task == PostNestedTask::YES)
- PostTask(PostNestedTask::NO, nullptr);
+ PostTask(PostNestedTask::NO, Closure());
EXPECT_TRUE(task_runner_->RunsTasksOnCurrentThread());
@@ -73,8 +73,8 @@ void TestTaskFactory::RunTaskCallback(size_t task_index,
cv_.Signal();
}
- if (event)
- event->Wait();
+ if (!closure.is_null())
+ closure.Run();
}
} // namespace test

Powered by Google App Engine
This is Rietveld 408576698