Update V8 to version 4.6.63.
[chromium-blink-merge.git] / chromecast / base / task_runner_impl.cc
blob1fb8fc55d6e6b9e847f6ad3a31ae07cc2ebca517
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.
5 #include "chromecast/base/task_runner_impl.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
12 namespace chromecast {
14 TaskRunnerImpl::TaskRunnerImpl()
15 : runner_(base::ThreadTaskRunnerHandle::Get()) {
16 DCHECK(runner_.get());
19 TaskRunnerImpl::~TaskRunnerImpl() {}
21 bool TaskRunnerImpl::PostTask(Task* task, uint64_t delay_milliseconds) {
22 DCHECK(task);
23 if (delay_milliseconds == 0 && runner_->BelongsToCurrentThread()) {
24 task->Run();
25 delete task;
26 return true;
29 // TODO(halliwell): FROM_HERE is misleading, we should consider a macro for
30 // vendor backends to send the callsite info.
31 return runner_->PostDelayedTask(
32 FROM_HERE, base::Bind(&Task::Run, base::Owned(task)),
33 base::TimeDelta::FromMilliseconds(delay_milliseconds));
36 } // namespace chromecast