OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 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 #include "content/child/worker_thread_task_runner.h" | |
6 | |
7 #include "webkit/child/worker_task_runner.h" | |
8 | |
9 using webkit_glue::WorkerTaskRunner; | |
10 | |
11 namespace content { | |
12 | |
13 WorkerThreadTaskRunner::WorkerThreadTaskRunner(int worker_thread_id) | |
14 : worker_thread_id_(worker_thread_id) { | |
15 } | |
16 | |
17 scoped_refptr<WorkerThreadTaskRunner> WorkerThreadTaskRunner::current() { | |
18 int worker_thread_id = WorkerTaskRunner::Instance()->CurrentWorkerId(); | |
19 if (!worker_thread_id) | |
20 return scoped_refptr<WorkerThreadTaskRunner>(); | |
21 return make_scoped_refptr(new WorkerThreadTaskRunner(worker_thread_id)); | |
22 } | |
23 | |
24 bool WorkerThreadTaskRunner::PostDelayedTask( | |
25 const tracked_objects::Location& /* from_here */, | |
26 const base::Closure& task, | |
27 base::TimeDelta /* delay */) { | |
michaeln
2013/11/18 17:51:42
should we assert if delay != 0 for now?
kinuko
2013/11/19 04:51:34
Done.
| |
28 return WorkerTaskRunner::Instance()->PostTask(worker_thread_id_, task); | |
29 } | |
30 | |
31 bool WorkerThreadTaskRunner::RunsTasksOnCurrentThread() const { | |
32 return worker_thread_id_ == WorkerTaskRunner::Instance()->CurrentWorkerId(); | |
33 } | |
34 | |
35 WorkerThreadTaskRunner::~WorkerThreadTaskRunner() {} | |
36 | |
37 } // namespace content | |
OLD | NEW |