| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 sequence_sort_key); | 433 sequence_sort_key); |
| 434 | 434 |
| 435 // Wake up a worker to process |sequence|. | 435 // Wake up a worker to process |sequence|. |
| 436 if (worker) | 436 if (worker) |
| 437 worker->WakeUp(); | 437 worker->WakeUp(); |
| 438 else | 438 else |
| 439 WakeUpOneWorker(); | 439 WakeUpOneWorker(); |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 void SchedulerWorkerPoolImpl::GetHistograms( |
| 444 std::vector<const HistogramBase*>* histograms) const { |
| 445 histograms->push_back(detach_duration_histogram_); |
| 446 histograms->push_back(num_tasks_between_waits_histogram_); |
| 447 } |
| 448 |
| 443 SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner:: | 449 SchedulerWorkerPoolImpl::SchedulerSingleThreadTaskRunner:: |
| 444 SchedulerSingleThreadTaskRunner(const TaskTraits& traits, | 450 SchedulerSingleThreadTaskRunner(const TaskTraits& traits, |
| 445 SchedulerWorkerPool* worker_pool, | 451 SchedulerWorkerPool* worker_pool, |
| 446 SchedulerWorker* worker) | 452 SchedulerWorker* worker) |
| 447 : traits_(traits), | 453 : traits_(traits), |
| 448 worker_pool_(worker_pool), | 454 worker_pool_(worker_pool), |
| 449 worker_(worker) { | 455 worker_(worker) { |
| 450 DCHECK(worker_pool_); | 456 DCHECK(worker_pool_); |
| 451 DCHECK(worker_); | 457 DCHECK(worker_); |
| 452 static_cast<SchedulerWorkerDelegateImpl*>(worker_->delegate())-> | 458 static_cast<SchedulerWorkerDelegateImpl*>(worker_->delegate())-> |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); | 758 AutoSchedulerLock auto_lock(idle_workers_stack_lock_); |
| 753 idle_workers_stack_.Remove(worker); | 759 idle_workers_stack_.Remove(worker); |
| 754 } | 760 } |
| 755 | 761 |
| 756 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { | 762 bool SchedulerWorkerPoolImpl::CanWorkerDetachForTesting() { |
| 757 return !worker_detachment_disallowed_.IsSet(); | 763 return !worker_detachment_disallowed_.IsSet(); |
| 758 } | 764 } |
| 759 | 765 |
| 760 } // namespace internal | 766 } // namespace internal |
| 761 } // namespace base | 767 } // namespace base |
| OLD | NEW |