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/base/task_queue_impl.h" | 5 #include "components/scheduler/base/task_queue_impl.h" |
6 | 6 |
7 #include "components/scheduler/base/task_queue_manager.h" | 7 #include "components/scheduler/base/task_queue_manager.h" |
8 #include "components/scheduler/base/task_queue_manager_delegate.h" | 8 #include "components/scheduler/base/task_queue_manager_delegate.h" |
9 #include "components/scheduler/base/time_domain.h" | 9 #include "components/scheduler/base/time_domain.h" |
10 #include "components/scheduler/base/work_queue.h" | 10 #include "components/scheduler/base/work_queue.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 bool TaskQueueImpl::PostDelayedTaskImpl( | 142 bool TaskQueueImpl::PostDelayedTaskImpl( |
143 const tracked_objects::Location& from_here, | 143 const tracked_objects::Location& from_here, |
144 const base::Closure& task, | 144 const base::Closure& task, |
145 base::TimeDelta delay, | 145 base::TimeDelta delay, |
146 TaskType task_type) { | 146 TaskType task_type) { |
147 base::AutoLock lock(any_thread_lock_); | 147 base::AutoLock lock(any_thread_lock_); |
148 if (!any_thread().task_queue_manager) | 148 if (!any_thread().task_queue_manager) |
149 return false; | 149 return false; |
150 LazyNow lazy_now(any_thread().time_domain->CreateLazyNow()); | 150 LazyNow lazy_now(any_thread().time_domain->CreateLazyNow()); |
151 base::TimeTicks desired_run_time; | 151 base::TimeTicks desired_run_time; |
152 if (delay > base::TimeDelta()) { | 152 if (delay > base::TimeDelta()) |
153 base::TimeTicks time_domain_now = lazy_now.Now(); | 153 desired_run_time = lazy_now.Now() + delay; |
154 desired_run_time = | |
155 any_thread().time_domain->ComputeDelayedRunTime(time_domain_now, delay); | |
156 } | |
157 return PostDelayedTaskLocked(&lazy_now, from_here, task, desired_run_time, | 154 return PostDelayedTaskLocked(&lazy_now, from_here, task, desired_run_time, |
158 task_type); | 155 task_type); |
159 } | 156 } |
160 | 157 |
161 bool TaskQueueImpl::PostDelayedTaskLocked( | 158 bool TaskQueueImpl::PostDelayedTaskLocked( |
162 LazyNow* lazy_now, | 159 LazyNow* lazy_now, |
163 const tracked_objects::Location& from_here, | 160 const tracked_objects::Location& from_here, |
164 const base::Closure& task, | 161 const base::Closure& task, |
165 base::TimeTicks desired_run_time, | 162 base::TimeTicks desired_run_time, |
166 TaskType task_type) { | 163 TaskType task_type) { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 state->SetBoolean("nestable", task.nestable); | 579 state->SetBoolean("nestable", task.nestable); |
583 state->SetBoolean("is_high_res", task.is_high_res); | 580 state->SetBoolean("is_high_res", task.is_high_res); |
584 state->SetDouble( | 581 state->SetDouble( |
585 "delayed_run_time", | 582 "delayed_run_time", |
586 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); | 583 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); |
587 state->EndDictionary(); | 584 state->EndDictionary(); |
588 } | 585 } |
589 | 586 |
590 } // namespace internal | 587 } // namespace internal |
591 } // namespace scheduler | 588 } // namespace scheduler |
OLD | NEW |