| Index: mojo/edk/system/test/test_io_thread.cc
|
| diff --git a/mojo/edk/system/test/test_io_thread.cc b/mojo/edk/system/test/test_io_thread.cc
|
| index eaa218a9fa06707598ce8b204e02e4610e76cf06..c425f6f4236a68bcf3918ce8dd83b524fd2024ac 100644
|
| --- a/mojo/edk/system/test/test_io_thread.cc
|
| +++ b/mojo/edk/system/test/test_io_thread.cc
|
| @@ -4,7 +4,8 @@
|
|
|
| #include "mojo/edk/system/test/test_io_thread.h"
|
|
|
| -#include "base/bind.h"
|
| +#include <utility>
|
| +
|
| #include "mojo/edk/util/waitable_event.h"
|
|
|
| using mojo::util::AutoResetWaitableEvent;
|
| @@ -14,16 +15,6 @@ namespace mojo {
|
| namespace system {
|
| namespace test {
|
|
|
| -namespace {
|
| -
|
| -void PostTaskAndWaitHelper(AutoResetWaitableEvent* event,
|
| - const base::Closure& task) {
|
| - task.Run();
|
| - event->Signal();
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| TestIOThread::TestIOThread(StartMode start_mode)
|
| : io_thread_("test_io_thread"), io_thread_started_(false) {
|
| switch (start_mode) {
|
| @@ -60,16 +51,27 @@ bool TestIOThread::IsCurrentAndRunning() const {
|
| io_thread_.message_loop()->is_running();
|
| }
|
|
|
| +void TestIOThread::PostTask(std::function<void()>&& task) {
|
| + io_task_runner_->PostTask(std::move(task));
|
| +}
|
| +
|
| void TestIOThread::PostTask(const base::Closure& task) {
|
| io_task_runner_->PostTask(task);
|
| }
|
|
|
| -void TestIOThread::PostTaskAndWait(const base::Closure& task) {
|
| +void TestIOThread::PostTaskAndWait(std::function<void()>&& task) {
|
| AutoResetWaitableEvent event;
|
| - io_task_runner_->PostTask(base::Bind(&PostTaskAndWaitHelper, &event, task));
|
| + io_task_runner_->PostTask([&task, &event]() {
|
| + task();
|
| + event.Signal();
|
| + });
|
| event.Wait();
|
| }
|
|
|
| +void TestIOThread::PostTaskAndWait(const base::Closure& task) {
|
| + PostTaskAndWait([&task]() { task.Run(); });
|
| +}
|
| +
|
| } // namespace test
|
| } // namespace system
|
| } // namespace mojo
|
|
|