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/task_scheduler_impl.h" | 5 #include "base/task_scheduler/task_scheduler_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/metrics/histogram_base.h" | |
12 #include "base/task_scheduler/scheduler_service_thread.h" | 13 #include "base/task_scheduler/scheduler_service_thread.h" |
13 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 14 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
14 #include "base/task_scheduler/sequence_sort_key.h" | 15 #include "base/task_scheduler/sequence_sort_key.h" |
15 #include "base/task_scheduler/task.h" | 16 #include "base/task_scheduler/task.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 namespace internal { | 20 namespace internal { |
20 | 21 |
21 // static | 22 // static |
(...skipping 23 matching lines...) Expand all Loading... | |
45 make_scoped_refptr(new Sequence), nullptr); | 46 make_scoped_refptr(new Sequence), nullptr); |
46 } | 47 } |
47 | 48 |
48 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits( | 49 scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits( |
49 const TaskTraits& traits, | 50 const TaskTraits& traits, |
50 ExecutionMode execution_mode) { | 51 ExecutionMode execution_mode) { |
51 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits( | 52 return GetWorkerPoolForTraits(traits)->CreateTaskRunnerWithTraits( |
52 traits, execution_mode); | 53 traits, execution_mode); |
53 } | 54 } |
54 | 55 |
56 std::vector<const HistogramBase*> TaskSchedulerImpl::GetHistograms() const { | |
57 std::vector<const HistogramBase*> histograms; | |
58 for (const auto& worker_pool : worker_pools_) { | |
fdoray
2016/10/18 16:50:25
no braces
| |
59 worker_pool->ReportHistograms(&histograms); | |
60 } | |
61 return histograms; | |
62 } | |
63 | |
55 void TaskSchedulerImpl::Shutdown() { | 64 void TaskSchedulerImpl::Shutdown() { |
56 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown. | 65 // TODO(fdoray): Increase the priority of BACKGROUND tasks blocking shutdown. |
57 task_tracker_.Shutdown(); | 66 task_tracker_.Shutdown(); |
58 } | 67 } |
59 | 68 |
60 void TaskSchedulerImpl::FlushForTesting() { | 69 void TaskSchedulerImpl::FlushForTesting() { |
61 task_tracker_.Flush(); | 70 task_tracker_.Flush(); |
62 } | 71 } |
63 | 72 |
64 void TaskSchedulerImpl::JoinForTesting() { | 73 void TaskSchedulerImpl::JoinForTesting() { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), | 137 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), |
129 sort_key); | 138 sort_key); |
130 } | 139 } |
131 | 140 |
132 void TaskSchedulerImpl::OnDelayedRunTimeUpdated() { | 141 void TaskSchedulerImpl::OnDelayedRunTimeUpdated() { |
133 service_thread_->WakeUp(); | 142 service_thread_->WakeUp(); |
134 } | 143 } |
135 | 144 |
136 } // namespace internal | 145 } // namespace internal |
137 } // namespace base | 146 } // namespace base |
OLD | NEW |