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 | 9 |
10 namespace scheduler { | 10 namespace scheduler { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NORMAL); | 90 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NORMAL); |
91 } | 91 } |
92 | 92 |
93 bool TaskQueueImpl::PostNonNestableDelayedTask( | 93 bool TaskQueueImpl::PostNonNestableDelayedTask( |
94 const tracked_objects::Location& from_here, | 94 const tracked_objects::Location& from_here, |
95 const base::Closure& task, | 95 const base::Closure& task, |
96 base::TimeDelta delay) { | 96 base::TimeDelta delay) { |
97 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NON_NESTABLE); | 97 return PostDelayedTaskImpl(from_here, task, delay, TaskType::NON_NESTABLE); |
98 } | 98 } |
99 | 99 |
100 bool TaskQueueImpl::PostDelayedTaskAt( | |
101 const tracked_objects::Location& from_here, | |
102 const base::Closure& task, | |
103 base::TimeTicks desired_run_time) { | |
104 base::AutoLock lock(any_thread_lock_); | |
105 if (!any_thread().task_queue_manager) | |
106 return false; | |
107 LazyNow lazy_now(any_thread().task_queue_manager->delegate().get()); | |
108 return PostDelayedTaskLocked(&lazy_now, from_here, task, desired_run_time, | |
109 TaskType::NORMAL); | |
110 } | |
111 | |
112 bool TaskQueueImpl::PostDelayedTaskImpl( | 100 bool TaskQueueImpl::PostDelayedTaskImpl( |
113 const tracked_objects::Location& from_here, | 101 const tracked_objects::Location& from_here, |
114 const base::Closure& task, | 102 const base::Closure& task, |
115 base::TimeDelta delay, | 103 base::TimeDelta delay, |
116 TaskType task_type) { | 104 TaskType task_type) { |
117 base::AutoLock lock(any_thread_lock_); | 105 base::AutoLock lock(any_thread_lock_); |
118 if (!any_thread().task_queue_manager) | 106 if (!any_thread().task_queue_manager) |
119 return false; | 107 return false; |
120 LazyNow lazy_now(any_thread().task_queue_manager->delegate().get()); | 108 LazyNow lazy_now(any_thread().task_queue_manager->delegate().get()); |
121 base::TimeTicks desired_run_time; | 109 base::TimeTicks desired_run_time; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 state->SetBoolean("nestable", task.nestable); | 499 state->SetBoolean("nestable", task.nestable); |
512 state->SetBoolean("is_high_res", task.is_high_res); | 500 state->SetBoolean("is_high_res", task.is_high_res); |
513 state->SetDouble( | 501 state->SetDouble( |
514 "delayed_run_time", | 502 "delayed_run_time", |
515 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); | 503 (task.delayed_run_time - base::TimeTicks()).InMicroseconds() / 1000.0L); |
516 state->EndDictionary(); | 504 state->EndDictionary(); |
517 } | 505 } |
518 | 506 |
519 } // namespace internal | 507 } // namespace internal |
520 } // namespace scheduler | 508 } // namespace scheduler |
OLD | NEW |