| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "platform/scheduler/child/web_scheduler_impl.h" | 5 #include "platform/scheduler/child/web_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "platform/scheduler/child/web_task_runner_impl.h" | 10 #include "platform/scheduler/child/web_task_runner_impl.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void WebSchedulerImpl::runIdleTask( | 43 void WebSchedulerImpl::runIdleTask( |
| 44 std::unique_ptr<blink::WebThread::IdleTask> task, | 44 std::unique_ptr<blink::WebThread::IdleTask> task, |
| 45 base::TimeTicks deadline) { | 45 base::TimeTicks deadline) { |
| 46 task->run((deadline - base::TimeTicks()).InSecondsF()); | 46 task->run((deadline - base::TimeTicks()).InSecondsF()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& location, | 49 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& location, |
| 50 blink::WebThread::IdleTask* task) { | 50 blink::WebThread::IdleTask* task) { |
| 51 DCHECK(idle_task_runner_); | 51 DCHECK(idle_task_runner_); |
| 52 idle_task_runner_->PostIdleTask( | 52 idle_task_runner_->PostIdleTask( |
| 53 location, base::Bind(&WebSchedulerImpl::runIdleTask, | 53 location, |
| 54 base::Passed(base::WrapUnique(task)))); | 54 base::Bind(&WebSchedulerImpl::runIdleTask, |
| 55 base::Passed(base::WrapUnique(task)))); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void WebSchedulerImpl::postNonNestableIdleTask( | 58 void WebSchedulerImpl::postNonNestableIdleTask( |
| 58 const blink::WebTraceLocation& location, | 59 const blink::WebTraceLocation& location, |
| 59 blink::WebThread::IdleTask* task) { | 60 blink::WebThread::IdleTask* task) { |
| 60 DCHECK(idle_task_runner_); | 61 DCHECK(idle_task_runner_); |
| 61 idle_task_runner_->PostNonNestableIdleTask( | 62 idle_task_runner_->PostNonNestableIdleTask( |
| 62 location, base::Bind(&WebSchedulerImpl::runIdleTask, | 63 location, |
| 63 base::Passed(base::WrapUnique(task)))); | 64 base::Bind(&WebSchedulerImpl::runIdleTask, |
| 65 base::Passed(base::WrapUnique(task)))); |
| 64 } | 66 } |
| 65 | 67 |
| 66 blink::WebTaskRunner* WebSchedulerImpl::loadingTaskRunner() { | 68 blink::WebTaskRunner* WebSchedulerImpl::loadingTaskRunner() { |
| 67 return loading_web_task_runner_.get(); | 69 return loading_web_task_runner_.get(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 blink::WebTaskRunner* WebSchedulerImpl::timerTaskRunner() { | 72 blink::WebTaskRunner* WebSchedulerImpl::timerTaskRunner() { |
| 71 return timer_web_task_runner_.get(); | 73 return timer_web_task_runner_.get(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 std::unique_ptr<blink::WebViewScheduler> | 76 std::unique_ptr<blink::WebViewScheduler> |
| 75 WebSchedulerImpl::createWebViewScheduler( | 77 WebSchedulerImpl::createWebViewScheduler( |
| 76 InterventionReporter*, | 78 InterventionReporter*, |
| 77 WebViewScheduler::WebViewSchedulerSettings*) { | 79 WebViewScheduler::WebViewSchedulerSettings*) { |
| 78 NOTREACHED(); | 80 NOTREACHED(); |
| 79 return nullptr; | 81 return nullptr; |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace scheduler | 84 } // namespace scheduler |
| 83 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |