OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/task_scheduler/scheduler_worker_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 scoped_refptr<Sequence> sequence) { | 245 scoped_refptr<Sequence> sequence) { |
246 DCHECK(task); | 246 DCHECK(task); |
247 DCHECK(sequence); | 247 DCHECK(sequence); |
248 | 248 |
249 if (!task_tracker_->WillPostTask(task.get())) | 249 if (!task_tracker_->WillPostTask(task.get())) |
250 return false; | 250 return false; |
251 | 251 |
252 if (task->delayed_run_time.is_null()) { | 252 if (task->delayed_run_time.is_null()) { |
253 PostTaskWithSequenceNow(std::move(task), std::move(sequence)); | 253 PostTaskWithSequenceNow(std::move(task), std::move(sequence)); |
254 } else { | 254 } else { |
| 255 DCHECK(task->task); |
255 delayed_task_manager_->AddDelayedTask( | 256 delayed_task_manager_->AddDelayedTask( |
256 std::move(task), | 257 std::move(task), |
257 Bind( | 258 Bind( |
258 [](scoped_refptr<Sequence> sequence, | 259 [](scoped_refptr<Sequence> sequence, |
259 SchedulerWorkerPool* worker_pool, std::unique_ptr<Task> task) { | 260 SchedulerWorkerPool* worker_pool, std::unique_ptr<Task> task) { |
260 worker_pool->PostTaskWithSequenceNow(std::move(task), | 261 worker_pool->PostTaskWithSequenceNow(std::move(task), |
261 std::move(sequence)); | 262 std::move(sequence)); |
262 }, | 263 }, |
263 std::move(sequence), Unretained(this))); | 264 std::move(sequence), Unretained(this))); |
264 } | 265 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 587 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
587 idle_workers_stack_.Remove(worker); | 588 idle_workers_stack_.Remove(worker); |
588 } | 589 } |
589 | 590 |
590 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { | 591 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { |
591 return !worker_detachment_disallowed_.IsSet(); | 592 return !worker_detachment_disallowed_.IsSet(); |
592 } | 593 } |
593 | 594 |
594 } // namespace internal | 595 } // namespace internal |
595 } // namespace base | 596 } // namespace base |
OLD | NEW |