OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // NOTE: This is included in the review for clarity, but this will be submitted |
| 6 // in halliwell@'s review (1257013003), so this should be removed before |
| 7 // submit. |
| 8 |
| 9 #include "chromecast/base/task_runner_impl.h" |
| 10 |
| 11 #include "base/bind.h" |
| 12 #include "base/location.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/thread_task_runner_handle.h" |
| 15 |
| 16 namespace chromecast { |
| 17 |
| 18 TaskRunnerImpl::TaskRunnerImpl() |
| 19 : runner_(base::ThreadTaskRunnerHandle::Get()) { |
| 20 DCHECK(runner_.get()); |
| 21 } |
| 22 |
| 23 TaskRunnerImpl::~TaskRunnerImpl() { |
| 24 } |
| 25 |
| 26 bool TaskRunnerImpl::BelongsToCurrentThread() { |
| 27 return runner_->BelongsToCurrentThread(); |
| 28 } |
| 29 |
| 30 bool TaskRunnerImpl::PostTask(Task* task, uint64_t delay_milliseconds) { |
| 31 // TODO(halliwell): FROM_HERE is misleading, we should consider a macro for |
| 32 // vendor backends to send the callsite info. |
| 33 return runner_->PostDelayedTask( |
| 34 FROM_HERE, |
| 35 base::Bind(&Task::Run, base::Owned(task)), |
| 36 base::TimeDelta::FromMilliseconds(delay_milliseconds)); |
| 37 } |
| 38 |
| 39 } // namespace chromecast |
OLD | NEW |