Chromium Code Reviews| 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..8952687182e13fa082b41b871ba1d7828206370b |
| --- /dev/null |
| +++ b/chromecast/base/task_runner_impl.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright (c) 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. |
| + |
| +#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" |
| +#include "chromecast/base/time_conversions.h" |
| + |
| +namespace chromecast { |
| + |
| +TaskRunnerImpl::TaskRunnerImpl() |
| + : runner_(base::ThreadTaskRunnerHandle::Get()) {} |
|
byungchul
2015/07/27 18:22:22
DCHECK(runner_.get());
halliwell
2015/07/28 02:19:34
Done.
|
| + |
| +TaskRunnerImpl::~TaskRunnerImpl() {} |
|
byungchul
2015/07/27 18:22:22
wrap line after {
halliwell
2015/07/28 02:19:35
clang format prefers it this way
|
| + |
| +bool TaskRunnerImpl::BelongsToCurrentThread() { |
| + return runner_->BelongsToCurrentThread(); |
| +} |
| + |
| +bool TaskRunnerImpl::PostTask(Task* task) { |
| + return runner_->PostTask(FROM_HERE, |
|
servolk
2015/07/27 21:25:47
Nit: this will make it look like all posttasks are
halliwell
2015/07/28 02:19:35
Good point. the downside to passing the info thro
servolk
2015/07/28 18:12:55
TBH I don't remember if I ever used this info dire
halliwell
2015/07/28 23:26:05
Ok, TODO and internal tracking bug filed.
servolk
2015/07/29 01:46:26
Wait, I meant a TODO comment in code, e.g. //TODO(
halliwell
2015/07/29 01:55:54
The TODO is in task_runner_impl.cc. Not sure Post
|
| + base::Bind(&Task::Run, base::Owned(task))); |
| +} |
| + |
| +bool TaskRunnerImpl::PostDelayedTask(Task* task, TimeDelta delay) { |
| + return runner_->PostDelayedTask(FROM_HERE, |
|
servolk
2015/07/27 21:25:47
Same
halliwell
2015/07/28 02:19:35
Same, need to introduce a new type. Let me know w
|
| + base::Bind(&Task::Run, base::Owned(task)), |
| + ToBaseTimeDelta(delay)); |
| +} |
| + |
| +} // namespace chromecast |