Chromium Code Reviews| 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 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 base::Thread::Options options; | 145 base::Thread::Options options; |
| 146 options.message_loop_type = base::MessageLoop::TYPE_IO; | 146 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 147 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); | 147 io_thread_.reset(new ServiceIOThread("ServiceProcess_IO")); |
| 148 file_thread_.reset(new base::Thread("ServiceProcess_File")); | 148 file_thread_.reset(new base::Thread("ServiceProcess_File")); |
| 149 if (!io_thread_->StartWithOptions(options) || | 149 if (!io_thread_->StartWithOptions(options) || |
| 150 !file_thread_->StartWithOptions(options)) { | 150 !file_thread_->StartWithOptions(options)) { |
| 151 NOTREACHED(); | 151 NOTREACHED(); |
| 152 Teardown(); | 152 Teardown(); |
| 153 return false; | 153 return false; |
| 154 } | 154 } |
| 155 blocking_pool_ = new base::SequencedWorkerPool(3, "ServiceBlocking"); | 155 blocking_pool_ = new base::SequencedWorkerPool( |
| 156 3, "ServiceBlocking", base::TaskPriority::BACKGROUND); | |
|
jam
2016/06/22 20:17:37
users will notice if this takes arbitrary long tim
gab
2016/06/22 21:08:56
Okay changing to USER_VISIBLE to keep it as foregr
| |
| 156 | 157 |
| 157 request_context_getter_ = new ServiceURLRequestContextGetter(); | 158 request_context_getter_ = new ServiceURLRequestContextGetter(); |
| 158 | 159 |
| 159 base::FilePath user_data_dir; | 160 base::FilePath user_data_dir; |
| 160 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 161 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 161 base::FilePath pref_path = | 162 base::FilePath pref_path = |
| 162 user_data_dir.Append(chrome::kServiceStateFileName); | 163 user_data_dir.Append(chrome::kServiceStateFileName); |
| 163 service_prefs_.reset(new ServiceProcessPrefs( | 164 service_prefs_.reset(new ServiceProcessPrefs( |
| 164 pref_path, | 165 pref_path, |
| 165 JsonPrefStore::GetTaskRunnerForFile(pref_path, blocking_pool_.get()) | 166 JsonPrefStore::GetTaskRunnerForFile(pref_path, blocking_pool_.get()) |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 } else { | 369 } else { |
| 369 Shutdown(); | 370 Shutdown(); |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 } | 373 } |
| 373 | 374 |
| 374 ServiceProcess::~ServiceProcess() { | 375 ServiceProcess::~ServiceProcess() { |
| 375 Teardown(); | 376 Teardown(); |
| 376 g_service_process = NULL; | 377 g_service_process = NULL; |
| 377 } | 378 } |
| OLD | NEW |