Deleting the forwarding header files base/debug/trace_event*
[chromium-blink-merge.git] / content / renderer / scheduler / web_scheduler_impl.cc
blob1ca8a302698478b6257dbfed7dcf45cac9d67fe8
1 // Copyright 2014 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 "content/renderer/scheduler/web_scheduler_impl.h"
7 #include "base/bind.h"
8 #include "content/renderer/scheduler/renderer_scheduler.h"
9 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
11 namespace content {
13 WebSchedulerImpl::WebSchedulerImpl(RendererScheduler* renderer_scheduler)
14 : renderer_scheduler_(renderer_scheduler),
15 idle_task_runner_(renderer_scheduler_->IdleTaskRunner()) {
18 WebSchedulerImpl::~WebSchedulerImpl() {
21 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() {
22 return renderer_scheduler_->ShouldYieldForHighPriorityWork();
25 void WebSchedulerImpl::runIdleTask(
26 scoped_ptr<blink::WebScheduler::IdleTask> task,
27 base::TimeTicks deadline) {
28 task->run((deadline - base::TimeTicks()).InSecondsF());
31 void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) {
32 task->run();
35 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location,
36 blink::WebScheduler::IdleTask* task) {
37 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task);
38 tracked_objects::Location location(web_location.functionName(),
39 web_location.fileName(), -1, nullptr);
40 idle_task_runner_->PostIdleTask(
41 location,
42 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task)));
45 void WebSchedulerImpl::postLoadingTask(
46 const blink::WebTraceLocation& web_location, blink::WebThread::Task* task) {
47 scoped_ptr<blink::WebThread::Task> scoped_task(task);
48 tracked_objects::Location location(web_location.functionName(),
49 web_location.fileName(), -1, nullptr);
50 renderer_scheduler_->LoadingTaskRunner()->PostTask(
51 location,
52 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)));
55 void WebSchedulerImpl::shutdown() {
56 return renderer_scheduler_->Shutdown();
59 } // namespace content