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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 workers_created_.Signal(); | 760 workers_created_.Signal(); |
761 #endif | 761 #endif |
762 | 762 |
763 return !workers_.empty(); | 763 return !workers_.empty(); |
764 } | 764 } |
765 | 765 |
766 void SchedulerWorkerPoolImpl::WakeUpWorker(SchedulerWorker* worker) { | 766 void SchedulerWorkerPoolImpl::WakeUpWorker(SchedulerWorker* worker) { |
767 DCHECK(worker); | 767 DCHECK(worker); |
768 RemoveFromIdleWorkersStack(worker); | 768 RemoveFromIdleWorkersStack(worker); |
769 worker->WakeUp(); | 769 worker->WakeUp(); |
770 // TOOD(robliao): Honor StandbyThreadPolicy::ONE here and consider adding | 770 // TODO(robliao): Honor StandbyThreadPolicy::ONE here and consider adding |
771 // hysteresis to the CanDetach check. See https://crbug.com/666041. | 771 // hysteresis to the CanDetach check. See https://crbug.com/666041. |
772 } | 772 } |
773 | 773 |
774 void SchedulerWorkerPoolImpl::WakeUpOneWorker() { | 774 void SchedulerWorkerPoolImpl::WakeUpOneWorker() { |
775 SchedulerWorker* worker; | 775 SchedulerWorker* worker; |
776 { | 776 { |
777 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 777 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
778 worker = idle_workers_stack_.Pop(); | 778 worker = idle_workers_stack_.Pop(); |
779 } | 779 } |
780 if (worker) | 780 if (worker) |
(...skipping 26 matching lines...) Expand all Loading... |
807 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 807 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
808 idle_workers_stack_.Remove(worker); | 808 idle_workers_stack_.Remove(worker); |
809 } | 809 } |
810 | 810 |
811 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { | 811 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { |
812 return !worker_detachment_disallowed_.IsSet(); | 812 return !worker_detachment_disallowed_.IsSet(); |
813 } | 813 } |
814 | 814 |
815 } // namespace internal | 815 } // namespace internal |
816 } // namespace base | 816 } // namespace base |
OLD | NEW |