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_RENDERER_WEBTHREAD_IMPL_FOR_RENDERER_SCHEDULER_H_
6 #define COMPONENTS_SCHEDULER_RENDERER_WEBTHREAD_IMPL_FOR_RENDERER_SCHEDULER_H_
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "components/scheduler/child/webthread_base.h"
16 class RendererScheduler
;
17 class WebSchedulerImpl
;
18 class WebTaskRunnerImpl
;
20 class SCHEDULER_EXPORT WebThreadImplForRendererScheduler
21 : public WebThreadBase
{
23 explicit WebThreadImplForRendererScheduler(RendererScheduler
* scheduler
);
24 virtual ~WebThreadImplForRendererScheduler();
26 // blink::WebThread implementation.
27 blink::WebScheduler
* scheduler() const;
28 blink::PlatformThreadId
threadId() const override
;
29 virtual blink::WebTaskRunner
* taskRunner();
31 // WebThreadBase implementation.
32 base::SingleThreadTaskRunner
* TaskRunner() const override
;
33 SingleThreadIdleTaskRunner
* IdleTaskRunner() const override
;
36 void AddTaskObserverInternal(
37 base::MessageLoop::TaskObserver
* observer
) override
;
38 void RemoveTaskObserverInternal(
39 base::MessageLoop::TaskObserver
* observer
) override
;
41 scoped_ptr
<WebSchedulerImpl
> web_scheduler_
;
42 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
43 scoped_refptr
<SingleThreadIdleTaskRunner
> idle_task_runner_
;
44 RendererScheduler
* scheduler_
; // Not owned.
45 blink::PlatformThreadId thread_id_
;
46 scoped_ptr
<WebTaskRunnerImpl
> web_task_runner_
;
49 } // namespace scheduler
51 #endif // COMPONENTS_SCHEDULER_RENDERER_WEBTHREAD_IMPL_FOR_RENDERER_SCHEDULER_H_