Index: chromecast/base/task_runner_impl.cc |
diff --git a/chromecast/base/task_runner_impl.cc b/chromecast/base/task_runner_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f188ca1358f7caa95825514fe03f46ba9bef6b7d |
--- /dev/null |
+++ b/chromecast/base/task_runner_impl.cc |
@@ -0,0 +1,39 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// NOTE: This is included in the review for clarity, but this will be submitted |
+// in halliwell@'s review (1257013003), so this should be removed before |
+// submit. |
+ |
+#include "chromecast/base/task_runner_impl.h" |
+ |
+#include "base/bind.h" |
+#include "base/location.h" |
+#include "base/single_thread_task_runner.h" |
+#include "base/thread_task_runner_handle.h" |
+ |
+namespace chromecast { |
+ |
+TaskRunnerImpl::TaskRunnerImpl() |
+ : runner_(base::ThreadTaskRunnerHandle::Get()) { |
+ DCHECK(runner_.get()); |
+} |
+ |
+TaskRunnerImpl::~TaskRunnerImpl() { |
+} |
+ |
+bool TaskRunnerImpl::BelongsToCurrentThread() { |
+ return runner_->BelongsToCurrentThread(); |
+} |
+ |
+bool TaskRunnerImpl::PostTask(Task* task, uint64_t delay_milliseconds) { |
+ // TODO(halliwell): FROM_HERE is misleading, we should consider a macro for |
+ // vendor backends to send the callsite info. |
+ return runner_->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&Task::Run, base::Owned(task)), |
+ base::TimeDelta::FromMilliseconds(delay_milliseconds)); |
+} |
+ |
+} // namespace chromecast |