Chromium Code Reviews| 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 "components/scheduler/child/web_scheduler_impl.h" | 5 #include "components/scheduler/child/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 "components/scheduler/child/web_task_runner_impl.h" | 9 #include "components/scheduler/child/web_task_runner_impl.h" |
| 10 #include "components/scheduler/child/worker_scheduler.h" | 10 #include "components/scheduler/child/worker_scheduler.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 std::unique_ptr<blink::WebThread::IdleTask> task, | 43 std::unique_ptr<blink::WebThread::IdleTask> task, |
| 44 base::TimeTicks deadline) { | 44 base::TimeTicks deadline) { |
| 45 task->run((deadline - base::TimeTicks()).InSecondsF()); | 45 task->run((deadline - base::TimeTicks()).InSecondsF()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, | 48 void WebSchedulerImpl::postIdleTask(const blink::WebTraceLocation& web_location, |
| 49 blink::WebThread::IdleTask* task) { | 49 blink::WebThread::IdleTask* task) { |
| 50 DCHECK(idle_task_runner_); | 50 DCHECK(idle_task_runner_); |
| 51 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); | 51 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); |
| 52 tracked_objects::Location location(web_location.functionName(), | 52 tracked_objects::Location location(web_location.functionName(), |
| 53 web_location.fileName(), -1, nullptr); | 53 web_location.fileName(), |
| 54 web_location.lineNumber(), | |
| 55 web_location.programCounter()); | |
|
kinuko
2016/07/14 05:51:14
Why don't we just have operator tracked_objects::L
tzik
2016/07/14 07:51:06
Done.
| |
| 54 idle_task_runner_->PostIdleTask( | 56 idle_task_runner_->PostIdleTask( |
| 55 location, | 57 location, |
| 56 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); | 58 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void WebSchedulerImpl::postNonNestableIdleTask( | 61 void WebSchedulerImpl::postNonNestableIdleTask( |
| 60 const blink::WebTraceLocation& web_location, | 62 const blink::WebTraceLocation& web_location, |
| 61 blink::WebThread::IdleTask* task) { | 63 blink::WebThread::IdleTask* task) { |
| 62 DCHECK(idle_task_runner_); | 64 DCHECK(idle_task_runner_); |
| 63 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); | 65 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); |
| 64 tracked_objects::Location location(web_location.functionName(), | 66 tracked_objects::Location location(web_location.functionName(), |
| 65 web_location.fileName(), -1, nullptr); | 67 web_location.fileName(), |
| 68 web_location.lineNumber(), | |
| 69 web_location.programCounter()); | |
| 66 idle_task_runner_->PostNonNestableIdleTask( | 70 idle_task_runner_->PostNonNestableIdleTask( |
| 67 location, | 71 location, |
| 68 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); | 72 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void WebSchedulerImpl::postIdleTaskAfterWakeup( | 75 void WebSchedulerImpl::postIdleTaskAfterWakeup( |
| 72 const blink::WebTraceLocation& web_location, | 76 const blink::WebTraceLocation& web_location, |
| 73 blink::WebThread::IdleTask* task) { | 77 blink::WebThread::IdleTask* task) { |
| 74 DCHECK(idle_task_runner_); | 78 DCHECK(idle_task_runner_); |
| 75 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); | 79 std::unique_ptr<blink::WebThread::IdleTask> scoped_task(task); |
| 76 tracked_objects::Location location(web_location.functionName(), | 80 tracked_objects::Location location(web_location.functionName(), |
| 77 web_location.fileName(), -1, nullptr); | 81 web_location.fileName(), |
| 82 web_location.lineNumber(), | |
| 83 web_location.programCounter()); | |
| 78 idle_task_runner_->PostIdleTaskAfterWakeup( | 84 idle_task_runner_->PostIdleTaskAfterWakeup( |
| 79 location, | 85 location, |
| 80 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); | 86 base::Bind(&WebSchedulerImpl::runIdleTask, base::Passed(&scoped_task))); |
| 81 } | 87 } |
| 82 | 88 |
| 83 blink::WebTaskRunner* WebSchedulerImpl::loadingTaskRunner() { | 89 blink::WebTaskRunner* WebSchedulerImpl::loadingTaskRunner() { |
| 84 return loading_web_task_runner_.get(); | 90 return loading_web_task_runner_.get(); |
| 85 } | 91 } |
| 86 | 92 |
| 87 blink::WebTaskRunner* WebSchedulerImpl::timerTaskRunner() { | 93 blink::WebTaskRunner* WebSchedulerImpl::timerTaskRunner() { |
| 88 return timer_web_task_runner_.get(); | 94 return timer_web_task_runner_.get(); |
| 89 } | 95 } |
| 90 | 96 |
| 91 std::unique_ptr<blink::WebViewScheduler> | 97 std::unique_ptr<blink::WebViewScheduler> |
| 92 WebSchedulerImpl::createWebViewScheduler(blink::WebView*) { | 98 WebSchedulerImpl::createWebViewScheduler(blink::WebView*) { |
| 93 NOTREACHED(); | 99 NOTREACHED(); |
| 94 return nullptr; | 100 return nullptr; |
| 95 } | 101 } |
| 96 | 102 |
| 97 } // namespace scheduler | 103 } // namespace scheduler |
| OLD | NEW |