| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/scheduler/web_scheduler_impl.h" | 5 #include "content/renderer/scheduler/web_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "content/renderer/scheduler/renderer_scheduler.h" | 9 #include "content/renderer/scheduler/renderer_scheduler.h" |
| 10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() { | 24 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() { |
| 25 return renderer_scheduler_->ShouldYieldForHighPriorityWork(); | 25 return renderer_scheduler_->ShouldYieldForHighPriorityWork(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool WebSchedulerImpl::canExceedIdleDeadlineIfRequired() { | 28 bool WebSchedulerImpl::canExceedIdleDeadlineIfRequired() { |
| 29 return renderer_scheduler_->CanExceedIdleDeadlineIfRequired(); | 29 return renderer_scheduler_->CanExceedIdleDeadlineIfRequired(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void WebSchedulerImpl::runIdleTask( | 32 void WebSchedulerImpl::runIdleTask(scoped_ptr<blink::WebThread::IdleTask> task, |
| 33 scoped_ptr<blink::WebThread::IdleTask> task, | 33 base::TimeTicks deadline) { |
| 34 base::TimeTicks deadline) { | |
| 35 task->run((deadline - base::TimeTicks()).InSecondsF()); | 34 task->run((deadline - base::TimeTicks()).InSecondsF()); |
| 36 } | 35 } |
| 37 | 36 |
| 38 void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) { | 37 void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) { |
| 39 task->run(); | 38 task->run(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, | 41 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, |
| 43 blink::WebThread::IdleTask* task) { | 42 blink::WebThread::IdleTask* task) { |
| 44 DCHECK(idle_task_runner_); | 43 DCHECK(idle_task_runner_); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 scoped_ptr<blink::WebThread::Task> scoped_task(task); | 92 scoped_ptr<blink::WebThread::Task> scoped_task(task); |
| 94 tracked_objects::Location location(web_location.functionName(), | 93 tracked_objects::Location location(web_location.functionName(), |
| 95 web_location.fileName(), -1, nullptr); | 94 web_location.fileName(), -1, nullptr); |
| 96 timer_task_runner_->PostDelayedTask( | 95 timer_task_runner_->PostDelayedTask( |
| 97 location, | 96 location, |
| 98 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), | 97 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), |
| 99 base::TimeDelta::FromMilliseconds(delayMs)); | 98 base::TimeDelta::FromMilliseconds(delayMs)); |
| 100 } | 99 } |
| 101 | 100 |
| 102 } // namespace content | 101 } // namespace content |
| OLD | NEW |