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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 void SchedulerWorkerPoolImpl::PostTaskWithSequenceNow( | 409 void SchedulerWorkerPoolImpl::PostTaskWithSequenceNow( |
410 std::unique_ptr<Task> task, | 410 std::unique_ptr<Task> task, |
411 scoped_refptr<Sequence> sequence, | 411 scoped_refptr<Sequence> sequence, |
412 SchedulerWorker* worker) { | 412 SchedulerWorker* worker) { |
413 DCHECK(task); | 413 DCHECK(task); |
414 DCHECK(sequence); | 414 DCHECK(sequence); |
415 DCHECK(!worker || ContainsWorker(workers_, worker)); | 415 DCHECK(!worker || ContainsWorker(workers_, worker)); |
416 | 416 |
417 // Confirm that |task| is ready to run (its delayed run time is either null or | 417 // Confirm that |task| is ready to run (its delayed run time is either null or |
418 // in the past). | 418 // in the past). |
419 DCHECK_LE(task->delayed_run_time, delayed_task_manager_->Now()); | 419 DCHECK_LE(task->delayed_run_time, TimeTicks::Now()); |
420 | 420 |
421 // Because |worker| belongs to this worker pool, we know that the type | 421 // Because |worker| belongs to this worker pool, we know that the type |
422 // of its delegate is SchedulerWorkerDelegateImpl. | 422 // of its delegate is SchedulerWorkerDelegateImpl. |
423 PriorityQueue* const priority_queue = | 423 PriorityQueue* const priority_queue = |
424 worker | 424 worker |
425 ? static_cast<SchedulerWorkerDelegateImpl*>(worker->delegate()) | 425 ? static_cast<SchedulerWorkerDelegateImpl*>(worker->delegate()) |
426 ->single_threaded_priority_queue() | 426 ->single_threaded_priority_queue() |
427 : &shared_priority_queue_; | 427 : &shared_priority_queue_; |
428 DCHECK(priority_queue); | 428 DCHECK(priority_queue); |
429 | 429 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 786 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
787 idle_workers_stack_.Remove(worker); | 787 idle_workers_stack_.Remove(worker); |
788 } | 788 } |
789 | 789 |
790 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { | 790 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { |
791 return !worker_detachment_disallowed_.IsSet(); | 791 return !worker_detachment_disallowed_.IsSet(); |
792 } | 792 } |
793 | 793 |
794 } // namespace internal | 794 } // namespace internal |
795 } // namespace base | 795 } // namespace base |
OLD | NEW |