Add a RendererWebSchedulerImpl with timer suspend & resume
[chromium-blink-merge.git] / components / scheduler / renderer / webthread_impl_for_renderer_scheduler.cc
blob28224564587ed09ed1c6dd90bf427552d245a056
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"
11 namespace scheduler {
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 {
26 return thread_id_;
29 blink::WebScheduler* WebThreadImplForRendererScheduler::scheduler() const {
30 return web_scheduler_.get();
33 base::SingleThreadTaskRunner* WebThreadImplForRendererScheduler::TaskRunner()
34 const {
35 return task_runner_.get();
38 SingleThreadIdleTaskRunner* WebThreadImplForRendererScheduler::IdleTaskRunner()
39 const {
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