Add owners for offlinepages
[chromium-blink-merge.git] / components / scheduler / child / webthread_impl_for_worker_scheduler.h
bloba09cde4746f37d55b1f0d6e96695e6e69670d579
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 #ifndef COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_IMPL_FOR_WORKER_SCHEDULER_H_
6 #define COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_IMPL_FOR_WORKER_SCHEDULER_H_
8 #include "components/scheduler/child/task_queue_manager.h"
9 #include "components/scheduler/child/webthread_base.h"
11 namespace base {
12 class WaitableEvent;
15 namespace blink {
16 class WebScheduler;
19 namespace scheduler {
20 class SchedulerTaskRunnerDelegate;
21 class SingleThreadIdleTaskRunner;
22 class WebSchedulerImpl;
23 class WebTaskRunnerImpl;
24 class WorkerScheduler;
26 class SCHEDULER_EXPORT WebThreadImplForWorkerScheduler
27 : public WebThreadBase,
28 public base::MessageLoop::DestructionObserver {
29 public:
30 explicit WebThreadImplForWorkerScheduler(const char* name);
31 virtual ~WebThreadImplForWorkerScheduler();
33 // blink::WebThread implementation.
34 virtual blink::WebScheduler* scheduler() const;
35 blink::PlatformThreadId threadId() const override;
36 virtual blink::WebTaskRunner* taskRunner();
38 // WebThreadBase implementation.
39 base::SingleThreadTaskRunner* TaskRunner() const override;
40 scheduler::SingleThreadIdleTaskRunner* IdleTaskRunner() const override;
42 // base::MessageLoop::DestructionObserver implementation.
43 void WillDestroyCurrentMessageLoop() override;
45 private:
46 void AddTaskObserverInternal(
47 base::MessageLoop::TaskObserver* observer) override;
48 void RemoveTaskObserverInternal(
49 base::MessageLoop::TaskObserver* observer) override;
51 void InitOnThread(base::WaitableEvent* completion);
52 void RestoreTaskRunnerOnThread(base::WaitableEvent* completion);
54 scoped_ptr<base::Thread> thread_;
55 scoped_ptr<scheduler::WorkerScheduler> worker_scheduler_;
56 scoped_ptr<scheduler::WebSchedulerImpl> web_scheduler_;
57 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner_;
58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
59 scoped_refptr<scheduler::SingleThreadIdleTaskRunner> idle_task_runner_;
60 scoped_refptr<SchedulerTaskRunnerDelegate> task_runner_delegate_;
61 scoped_ptr<WebTaskRunnerImpl> web_task_runner_;
64 } // namespace scheduler
66 #endif // COMPONENTS_SCHEDULER_CHILD_WEBTHREAD_IMPL_FOR_WORKER_SCHEDULER_H_