OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Initialize TaskScheduler and redirect SequencedWorkerPool tasks to it. | 165 // Initialize TaskScheduler and redirect SequencedWorkerPool tasks to it. |
166 using StandbyThreadPolicy = | 166 using StandbyThreadPolicy = |
167 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; | 167 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; |
168 constexpr int kMaxBackgroundThreads = 1; | 168 constexpr int kMaxBackgroundThreads = 1; |
169 constexpr int kMaxBackgroundBlockingThreads = 1; | 169 constexpr int kMaxBackgroundBlockingThreads = 1; |
170 constexpr int kMaxForegroundThreads = 3; | 170 constexpr int kMaxForegroundThreads = 3; |
171 constexpr int kMaxForegroundBlockingThreads = 3; | 171 constexpr int kMaxForegroundBlockingThreads = 3; |
172 constexpr base::TimeDelta kSuggestedReclaimTime = | 172 constexpr base::TimeDelta kSuggestedReclaimTime = |
173 base::TimeDelta::FromSeconds(30); | 173 base::TimeDelta::FromSeconds(30); |
174 | 174 |
175 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( | 175 base::TaskScheduler::Create("CloudPrintServiceProcess"); |
176 "CloudPrintServiceProcess", | 176 base::TaskScheduler::GetInstance()->Start( |
177 {{StandbyThreadPolicy::LAZY, kMaxBackgroundThreads, | 177 {{StandbyThreadPolicy::LAZY, kMaxBackgroundThreads, |
178 kSuggestedReclaimTime}, | 178 kSuggestedReclaimTime}, |
179 {StandbyThreadPolicy::LAZY, kMaxBackgroundBlockingThreads, | 179 {StandbyThreadPolicy::LAZY, kMaxBackgroundBlockingThreads, |
180 kSuggestedReclaimTime}, | 180 kSuggestedReclaimTime}, |
181 {StandbyThreadPolicy::LAZY, kMaxForegroundThreads, | 181 {StandbyThreadPolicy::LAZY, kMaxForegroundThreads, |
182 kSuggestedReclaimTime}, | 182 kSuggestedReclaimTime}, |
183 {StandbyThreadPolicy::LAZY, kMaxForegroundBlockingThreads, | 183 {StandbyThreadPolicy::LAZY, kMaxForegroundBlockingThreads, |
184 kSuggestedReclaimTime, | 184 kSuggestedReclaimTime, |
185 base::SchedulerBackwardCompatibility::INIT_COM_STA}}); | 185 base::SchedulerBackwardCompatibility::INIT_COM_STA}}); |
186 | 186 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } else { | 449 } else { |
450 Shutdown(); | 450 Shutdown(); |
451 } | 451 } |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 ServiceProcess::~ServiceProcess() { | 455 ServiceProcess::~ServiceProcess() { |
456 Teardown(); | 456 Teardown(); |
457 g_service_process = NULL; | 457 g_service_process = NULL; |
458 } | 458 } |
OLD | NEW |