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..03694f15e56dfaca78e666f2b45269cd00fa5632 |
--- /dev/null |
+++ b/chromecast/base/task_runner_impl.cc |
@@ -0,0 +1,35 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
gunsch
2015/07/29 17:22:36
I like how this is the same file as Luke's, but wi
slan
2015/07/29 19:51:54
:) Added a NOTE for review purposes.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#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 |