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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 base::Thread::Options options; | 150 base::Thread::Options options; |
151 options.message_loop_type = base::MessageLoop::TYPE_IO; | 151 options.message_loop_type = base::MessageLoop::TYPE_IO; |
152 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); | 152 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); |
153 file_thread_.reset(new base::Thread("ServiceProcess_File")); | 153 file_thread_.reset(new base::Thread("ServiceProcess_File")); |
154 if (!io_thread_->StartWithOptions(options) || | 154 if (!io_thread_->StartWithOptions(options) || |
155 !file_thread_->StartWithOptions(options)) { | 155 !file_thread_->StartWithOptions(options)) { |
156 NOTREACHED(); | 156 NOTREACHED(); |
157 Teardown(); | 157 Teardown(); |
158 return false; | 158 return false; |
159 } | 159 } |
| 160 |
| 161 // Enable SequencedWorkerPool in the service process. |
| 162 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler |
| 163 // redirection experiment concludes https://crbug.com/622400. |
| 164 base::SequencedWorkerPool::EnableForProcess(); |
| 165 |
160 blocking_pool_ = new base::SequencedWorkerPool( | 166 blocking_pool_ = new base::SequencedWorkerPool( |
161 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); | 167 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); |
162 | 168 |
163 // Initialize Mojo early so things can use it. | 169 // Initialize Mojo early so things can use it. |
164 mojo::edk::Init(); | 170 mojo::edk::Init(); |
165 mojo_ipc_support_.reset( | 171 mojo_ipc_support_.reset( |
166 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); | 172 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); |
167 | 173 |
168 request_context_getter_ = new ServiceURLRequestContextGetter(); | 174 request_context_getter_ = new ServiceURLRequestContextGetter(); |
169 | 175 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } else { | 418 } else { |
413 Shutdown(); | 419 Shutdown(); |
414 } | 420 } |
415 } | 421 } |
416 } | 422 } |
417 | 423 |
418 ServiceProcess::~ServiceProcess() { | 424 ServiceProcess::~ServiceProcess() { |
419 Teardown(); | 425 Teardown(); |
420 g_service_process = NULL; | 426 g_service_process = NULL; |
421 } | 427 } |
OLD | NEW |