This source file includes following definitions.
- current
- PostDelayedTask
- RunsTasksOnCurrentThread
#include "content/child/worker_thread_task_runner.h"
#include "base/logging.h"
#include "content/child/worker_task_runner.h"
namespace content {
WorkerThreadTaskRunner::WorkerThreadTaskRunner(int worker_thread_id)
: worker_thread_id_(worker_thread_id) {
}
scoped_refptr<WorkerThreadTaskRunner> WorkerThreadTaskRunner::current() {
int worker_thread_id = WorkerTaskRunner::Instance()->CurrentWorkerId();
if (!worker_thread_id)
return scoped_refptr<WorkerThreadTaskRunner>();
return make_scoped_refptr(new WorkerThreadTaskRunner(worker_thread_id));
}
bool WorkerThreadTaskRunner::PostDelayedTask(
const tracked_objects::Location& ,
const base::Closure& task,
base::TimeDelta delay) {
DCHECK(!delay.ToInternalValue());
return WorkerTaskRunner::Instance()->PostTask(worker_thread_id_, task);
}
bool WorkerThreadTaskRunner::RunsTasksOnCurrentThread() const {
return worker_thread_id_ == WorkerTaskRunner::Instance()->CurrentWorkerId();
}
WorkerThreadTaskRunner::~WorkerThreadTaskRunner() {}
}