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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 base::Thread::Options options; | 164 base::Thread::Options options; |
165 options.message_loop_type = base::MessageLoop::TYPE_IO; | 165 options.message_loop_type = base::MessageLoop::TYPE_IO; |
166 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); | 166 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); |
167 file_thread_.reset(new base::Thread("ServiceProcess_File")); | 167 file_thread_.reset(new base::Thread("ServiceProcess_File")); |
168 if (!io_thread_->StartWithOptions(options) || | 168 if (!io_thread_->StartWithOptions(options) || |
169 !file_thread_->StartWithOptions(options)) { | 169 !file_thread_->StartWithOptions(options)) { |
170 NOTREACHED(); | 170 NOTREACHED(); |
171 Teardown(); | 171 Teardown(); |
172 return false; | 172 return false; |
173 } | 173 } |
| 174 |
| 175 // Enable SequencedWorkerPool in the service process. |
| 176 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler |
| 177 // redirection experiment concludes https://crbug.com/622400. |
| 178 base::SequencedWorkerPool::EnableForProcess(); |
| 179 |
174 blocking_pool_ = new base::SequencedWorkerPool( | 180 blocking_pool_ = new base::SequencedWorkerPool( |
175 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); | 181 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); |
176 | 182 |
177 // Initialize Mojo early so things can use it. | 183 // Initialize Mojo early so things can use it. |
178 mojo::edk::Init(); | 184 mojo::edk::Init(); |
179 mojo_ipc_support_.reset( | 185 mojo_ipc_support_.reset( |
180 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); | 186 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); |
181 | 187 |
182 request_context_getter_ = new ServiceURLRequestContextGetter(); | 188 request_context_getter_ = new ServiceURLRequestContextGetter(); |
183 | 189 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } else { | 424 } else { |
419 Shutdown(); | 425 Shutdown(); |
420 } | 426 } |
421 } | 427 } |
422 } | 428 } |
423 | 429 |
424 ServiceProcess::~ServiceProcess() { | 430 ServiceProcess::~ServiceProcess() { |
425 Teardown(); | 431 Teardown(); |
426 g_service_process = NULL; | 432 g_service_process = NULL; |
427 } | 433 } |
OLD | NEW |