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 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); | 154 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); |
155 file_thread_.reset(new base::Thread("ServiceProcess_File")); | 155 file_thread_.reset(new base::Thread("ServiceProcess_File")); |
156 if (!io_thread_->StartWithOptions(options) || | 156 if (!io_thread_->StartWithOptions(options) || |
157 !file_thread_->StartWithOptions(options)) { | 157 !file_thread_->StartWithOptions(options)) { |
158 NOTREACHED(); | 158 NOTREACHED(); |
159 Teardown(); | 159 Teardown(); |
160 return false; | 160 return false; |
161 } | 161 } |
162 | 162 |
163 // Initialize TaskScheduler and redirect SequencedWorkerPool tasks to it. | 163 // Initialize TaskScheduler and redirect SequencedWorkerPool tasks to it. |
164 constexpr int kMaxTaskSchedulerThreads = 3; | |
165 base::TaskScheduler::CreateAndSetSimpleTaskScheduler( | 164 base::TaskScheduler::CreateAndSetSimpleTaskScheduler( |
166 kMaxTaskSchedulerThreads); | 165 "CloudPrintServiceProcess"); |
167 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); | 166 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); |
168 | 167 |
169 blocking_pool_ = new base::SequencedWorkerPool( | 168 blocking_pool_ = new base::SequencedWorkerPool( |
170 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); | 169 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); |
171 | 170 |
172 // Initialize Mojo early so things can use it. | 171 // Initialize Mojo early so things can use it. |
173 mojo::edk::Init(); | 172 mojo::edk::Init(); |
174 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( | 173 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( |
175 io_thread_->task_runner(), | 174 io_thread_->task_runner(), |
176 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST)); | 175 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST)); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } else { | 424 } else { |
426 Shutdown(); | 425 Shutdown(); |
427 } | 426 } |
428 } | 427 } |
429 } | 428 } |
430 | 429 |
431 ServiceProcess::~ServiceProcess() { | 430 ServiceProcess::~ServiceProcess() { |
432 Teardown(); | 431 Teardown(); |
433 g_service_process = NULL; | 432 g_service_process = NULL; |
434 } | 433 } |
OLD | NEW |