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 "content/renderer/scheduler/renderer_scheduler.h" | 8 #include "content/renderer/scheduler/renderer_scheduler.h" |
9 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 9 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() { | 21 bool WebSchedulerImpl::shouldYieldForHighPriorityWork() { |
22 return renderer_scheduler_->ShouldYieldForHighPriorityWork(); | 22 return renderer_scheduler_->ShouldYieldForHighPriorityWork(); |
23 } | 23 } |
24 | 24 |
25 void WebSchedulerImpl::runIdleTask( | 25 void WebSchedulerImpl::runIdleTask( |
26 scoped_ptr<blink::WebScheduler::IdleTask> task, | 26 scoped_ptr<blink::WebScheduler::IdleTask> task, |
27 base::TimeTicks deadline) { | 27 base::TimeTicks deadline) { |
28 task->run((deadline - base::TimeTicks()).InSecondsF()); | 28 task->run((deadline - base::TimeTicks()).InSecondsF()); |
29 } | 29 } |
30 | 30 |
| 31 void WebSchedulerImpl::runTask(scoped_ptr<blink::WebThread::Task> task) { |
| 32 task->run(); |
| 33 } |
| 34 |
31 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, | 35 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, |
32 blink::WebScheduler::IdleTask* task) { | 36 blink::WebScheduler::IdleTask* task) { |
33 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); | 37 scoped_ptr<blink::WebScheduler::IdleTask> scoped_task(task); |
34 tracked_objects::Location location(web_location.functionName(), | 38 tracked_objects::Location location(web_location.functionName(), |
35 web_location.fileName(), -1, nullptr); | 39 web_location.fileName(), -1, nullptr); |
36 idle_task_runner_->PostIdleTask( | 40 idle_task_runner_->PostIdleTask( |
37 location, | 41 location, |
38 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); | 42 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
39 } | 43 } |
40 | 44 |
| 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))); |
| 53 } |
| 54 |
41 void WebSchedulerImpl::shutdown() { | 55 void WebSchedulerImpl::shutdown() { |
42 return renderer_scheduler_->Shutdown(); | 56 return renderer_scheduler_->Shutdown(); |
43 } | 57 } |
44 | 58 |
45 } // namespace content | 59 } // namespace content |
OLD | NEW |