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 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h"
7 #include "components/scheduler/renderer/renderer_scheduler.h"
8 #include "components/scheduler/renderer/renderer_web_scheduler_impl.h"
9 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
13 WebThreadImplForRendererScheduler::WebThreadImplForRendererScheduler(
14 RendererScheduler
* scheduler
)
15 : web_scheduler_(new RendererWebSchedulerImpl(scheduler
)),
16 task_runner_(scheduler
->DefaultTaskRunner()),
17 idle_task_runner_(scheduler
->IdleTaskRunner()),
18 scheduler_(scheduler
),
19 thread_id_(base::PlatformThread::CurrentId()) {
22 WebThreadImplForRendererScheduler::~WebThreadImplForRendererScheduler() {
25 blink::PlatformThreadId
WebThreadImplForRendererScheduler::threadId() const {
29 blink::WebScheduler
* WebThreadImplForRendererScheduler::scheduler() const {
30 return web_scheduler_
.get();
33 base::SingleThreadTaskRunner
* WebThreadImplForRendererScheduler::TaskRunner()
35 return task_runner_
.get();
38 SingleThreadIdleTaskRunner
* WebThreadImplForRendererScheduler::IdleTaskRunner()
40 return idle_task_runner_
.get();
43 void WebThreadImplForRendererScheduler::AddTaskObserverInternal(
44 base::MessageLoop::TaskObserver
* observer
) {
45 scheduler_
->AddTaskObserver(observer
);
48 void WebThreadImplForRendererScheduler::RemoveTaskObserverInternal(
49 base::MessageLoop::TaskObserver
* observer
) {
50 scheduler_
->RemoveTaskObserver(observer
);
53 } // namespace scheduler