Refactoring of SessionService into a component part 3.
[chromium-blink-merge.git] / content / child / worker_thread_task_runner.h
blob5acafbd81e5db0445d74f5ac17321bb8ad610e4e
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.
5 #ifndef CONTENT_CHILD_WORKER_THREAD_TASK_RUNNER_H_
6 #define CONTENT_CHILD_WORKER_THREAD_TASK_RUNNER_H_
8 #include "base/task_runner.h"
10 namespace content {
12 // A task runner that runs tasks on a single webkit worker thread which
13 // is managed by WorkerTaskRunner.
14 // Note that this implementation ignores the delay duration for PostDelayedTask
15 // and have it behave the same as PostTask.
16 class WorkerThreadTaskRunner : public base::TaskRunner {
17 public:
18 explicit WorkerThreadTaskRunner(int worker_thread_id);
20 // Gets the WorkerThreadTaskRunner for the current worker thread.
21 // This returns non-null value only when it is called on a worker thread.
22 static scoped_refptr<WorkerThreadTaskRunner> current();
24 // TaskRunner overrides.
25 bool PostDelayedTask(const tracked_objects::Location& from_here,
26 const base::Closure& task,
27 base::TimeDelta delay) override;
28 bool RunsTasksOnCurrentThread() const override;
30 protected:
31 ~WorkerThreadTaskRunner() override;
33 private:
34 const int worker_thread_id_;
37 } // namespace content
39 #endif // CONTENT_CHILD_WORKER_THREAD_TASK_RUNNER_H_