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/child/task_queue.h"
8 #include "components/scheduler/renderer/renderer_scheduler.h"
9 #include "components/scheduler/renderer/renderer_web_scheduler_impl.h"
10 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
14 WebThreadImplForRendererScheduler::WebThreadImplForRendererScheduler(
15 RendererScheduler
* scheduler
)
16 : web_scheduler_(new RendererWebSchedulerImpl(scheduler
)),
17 task_runner_(scheduler
->DefaultTaskRunner()),
18 idle_task_runner_(scheduler
->IdleTaskRunner()),
19 scheduler_(scheduler
),
20 thread_id_(base::PlatformThread::CurrentId()) {
23 WebThreadImplForRendererScheduler::~WebThreadImplForRendererScheduler() {
26 blink::PlatformThreadId
WebThreadImplForRendererScheduler::threadId() const {
30 blink::WebScheduler
* WebThreadImplForRendererScheduler::scheduler() const {
31 return web_scheduler_
.get();
34 base::SingleThreadTaskRunner
* WebThreadImplForRendererScheduler::TaskRunner()
36 return task_runner_
.get();
39 SingleThreadIdleTaskRunner
* WebThreadImplForRendererScheduler::IdleTaskRunner()
41 return idle_task_runner_
.get();
44 void WebThreadImplForRendererScheduler::AddTaskObserverInternal(
45 base::MessageLoop::TaskObserver
* observer
) {
46 scheduler_
->AddTaskObserver(observer
);
49 void WebThreadImplForRendererScheduler::RemoveTaskObserverInternal(
50 base::MessageLoop::TaskObserver
* observer
) {
51 scheduler_
->RemoveTaskObserver(observer
);
54 } // namespace scheduler