Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: base/task_scheduler/task_scheduler_impl.cc

Issue 2873733003: Introduce SingleThreadTaskRunnerThreadMode (Closed)
Patch Set: Add missing "base" Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/task_scheduler/delayed_task_manager.h" 10 #include "base/task_scheduler/delayed_task_manager.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 scoped_refptr<SequencedTaskRunner> 136 scoped_refptr<SequencedTaskRunner>
137 TaskSchedulerImpl::CreateSequencedTaskRunnerWithTraits( 137 TaskSchedulerImpl::CreateSequencedTaskRunnerWithTraits(
138 const TaskTraits& traits) { 138 const TaskTraits& traits) {
139 return GetWorkerPoolForTraits(traits)->CreateSequencedTaskRunnerWithTraits( 139 return GetWorkerPoolForTraits(traits)->CreateSequencedTaskRunnerWithTraits(
140 traits); 140 traits);
141 } 141 }
142 142
143 scoped_refptr<SingleThreadTaskRunner> 143 scoped_refptr<SingleThreadTaskRunner>
144 TaskSchedulerImpl::CreateSingleThreadTaskRunnerWithTraits( 144 TaskSchedulerImpl::CreateSingleThreadTaskRunnerWithTraits(
145 const TaskTraits& traits) { 145 const TaskTraits& traits,
146 SingleThreadTaskRunnerThreadMode thread_mode) {
146 const auto& environment_params = 147 const auto& environment_params =
147 kEnvironmentParams[GetEnvironmentIndexForTraits(traits)]; 148 kEnvironmentParams[GetEnvironmentIndexForTraits(traits)];
148 return single_thread_task_runner_manager_ 149 return single_thread_task_runner_manager_
149 .CreateSingleThreadTaskRunnerWithTraits( 150 .CreateSingleThreadTaskRunnerWithTraits(
150 name_ + environment_params.name_suffix, 151 name_ + environment_params.name_suffix,
151 environment_params.priority_hint, traits); 152 environment_params.priority_hint, traits);
152 } 153 }
153 154
154 #if defined(OS_WIN) 155 #if defined(OS_WIN)
155 scoped_refptr<SingleThreadTaskRunner> 156 scoped_refptr<SingleThreadTaskRunner>
156 TaskSchedulerImpl::CreateCOMSTATaskRunnerWithTraits(const TaskTraits& traits) { 157 TaskSchedulerImpl::CreateCOMSTATaskRunnerWithTraits(
158 const TaskTraits& traits,
159 SingleThreadTaskRunnerThreadMode thread_mode) {
157 const auto& environment_params = 160 const auto& environment_params =
158 kEnvironmentParams[GetEnvironmentIndexForTraits(traits)]; 161 kEnvironmentParams[GetEnvironmentIndexForTraits(traits)];
159 return single_thread_task_runner_manager_.CreateCOMSTATaskRunnerWithTraits( 162 return single_thread_task_runner_manager_.CreateCOMSTATaskRunnerWithTraits(
160 environment_params.name_suffix, environment_params.priority_hint, traits); 163 environment_params.name_suffix, environment_params.priority_hint, traits);
161 } 164 }
162 #endif // defined(OS_WIN) 165 #endif // defined(OS_WIN)
163 166
164 std::vector<const HistogramBase*> TaskSchedulerImpl::GetHistograms() const { 167 std::vector<const HistogramBase*> TaskSchedulerImpl::GetHistograms() const {
165 std::vector<const HistogramBase*> histograms; 168 std::vector<const HistogramBase*> histograms;
166 for (const auto& worker_pool : worker_pools_) 169 for (const auto& worker_pool : worker_pools_)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 #endif 201 #endif
199 } 202 }
200 203
201 SchedulerWorkerPoolImpl* TaskSchedulerImpl::GetWorkerPoolForTraits( 204 SchedulerWorkerPoolImpl* TaskSchedulerImpl::GetWorkerPoolForTraits(
202 const TaskTraits& traits) const { 205 const TaskTraits& traits) const {
203 return worker_pools_[GetEnvironmentIndexForTraits(traits)].get(); 206 return worker_pools_[GetEnvironmentIndexForTraits(traits)].get();
204 } 207 }
205 208
206 } // namespace internal 209 } // namespace internal
207 } // namespace base 210 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/task_scheduler_impl.h ('k') | base/task_scheduler/task_scheduler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698