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 | |
166 blocking_pool_ = new base::SequencedWorkerPool( | 160 blocking_pool_ = new base::SequencedWorkerPool( |
167 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); | 161 3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE); |
168 | 162 |
169 // Initialize Mojo early so things can use it. | 163 // Initialize Mojo early so things can use it. |
170 mojo::edk::Init(); | 164 mojo::edk::Init(); |
171 mojo_ipc_support_.reset( | 165 mojo_ipc_support_.reset( |
172 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); | 166 new mojo::edk::ScopedIPCSupport(io_thread_->task_runner())); |
173 | 167 |
174 request_context_getter_ = new ServiceURLRequestContextGetter(); | 168 request_context_getter_ = new ServiceURLRequestContextGetter(); |
175 | 169 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } else { | 412 } else { |
419 Shutdown(); | 413 Shutdown(); |
420 } | 414 } |
421 } | 415 } |
422 } | 416 } |
423 | 417 |
424 ServiceProcess::~ServiceProcess() { | 418 ServiceProcess::~ServiceProcess() { |
425 Teardown(); | 419 Teardown(); |
426 g_service_process = NULL; | 420 g_service_process = NULL; |
427 } | 421 } |
OLD | NEW |