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/worker_scheduler.h" | 9 #include "components/scheduler/child/worker_scheduler.h" |
10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 10 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 DCHECK(timer_task_runner_); | 99 DCHECK(timer_task_runner_); |
100 scoped_ptr<blink::WebThread::Task> scoped_task(task); | 100 scoped_ptr<blink::WebThread::Task> scoped_task(task); |
101 tracked_objects::Location location(web_location.functionName(), | 101 tracked_objects::Location location(web_location.functionName(), |
102 web_location.fileName(), -1, nullptr); | 102 web_location.fileName(), -1, nullptr); |
103 timer_task_runner_->PostDelayedTask( | 103 timer_task_runner_->PostDelayedTask( |
104 location, | 104 location, |
105 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), | 105 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), |
106 base::TimeDelta::FromMilliseconds(delayMs)); | 106 base::TimeDelta::FromMilliseconds(delayMs)); |
107 } | 107 } |
108 | 108 |
| 109 void WebSchedulerImpl::postTimerTask( |
| 110 const blink::WebTraceLocation& web_location, |
| 111 blink::WebThread::Task* task, |
| 112 double delaySecs) { |
| 113 DCHECK(timer_task_runner_); |
| 114 scoped_ptr<blink::WebThread::Task> scoped_task(task); |
| 115 tracked_objects::Location location(web_location.functionName(), |
| 116 web_location.fileName(), -1, nullptr); |
| 117 timer_task_runner_->PostDelayedTask( |
| 118 location, |
| 119 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), |
| 120 base::TimeDelta::FromSecondsD(delaySecs)); |
| 121 } |
| 122 |
109 void WebSchedulerImpl::postTimerTaskAt( | 123 void WebSchedulerImpl::postTimerTaskAt( |
110 const blink::WebTraceLocation& web_location, | 124 const blink::WebTraceLocation& web_location, |
111 blink::WebThread::Task* task, | 125 blink::WebThread::Task* task, |
112 double monotonicTime) { | 126 double monotonicTime) { |
113 DCHECK(timer_task_runner_); | 127 DCHECK(timer_task_runner_); |
114 scoped_ptr<blink::WebThread::Task> scoped_task(task); | 128 scoped_ptr<blink::WebThread::Task> scoped_task(task); |
115 tracked_objects::Location location(web_location.functionName(), | 129 tracked_objects::Location location(web_location.functionName(), |
116 web_location.fileName(), -1, nullptr); | 130 web_location.fileName(), -1, nullptr); |
117 timer_task_runner_->PostDelayedTaskAt( | 131 timer_task_runner_->PostDelayedTaskAt( |
118 location, | 132 location, |
119 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), | 133 base::Bind(&WebSchedulerImpl::runTask, base::Passed(&scoped_task)), |
120 base::TimeTicks() + base::TimeDelta::FromSecondsD(monotonicTime)); | 134 base::TimeTicks() + base::TimeDelta::FromSecondsD(monotonicTime)); |
121 } | 135 } |
122 | 136 |
123 } // namespace scheduler | 137 } // namespace scheduler |
OLD | NEW |