| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return pid; | 149 return pid; |
| 150 } | 150 } |
| 151 | 151 |
| 152 ServiceProcessState::ServiceProcessState() : state_(NULL) { | 152 ServiceProcessState::ServiceProcessState() : state_(NULL) { |
| 153 } | 153 } |
| 154 | 154 |
| 155 ServiceProcessState::~ServiceProcessState() { | 155 ServiceProcessState::~ServiceProcessState() { |
| 156 TearDownState(); | 156 TearDownState(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // static |
| 160 ServiceProcessState* ServiceProcessState::GetInstance() { |
| 161 return Singleton<ServiceProcessState>::get(); |
| 162 } |
| 163 |
| 159 bool ServiceProcessState::Initialize() { | 164 bool ServiceProcessState::Initialize() { |
| 160 if (!TakeSingletonLock()) { | 165 if (!TakeSingletonLock()) { |
| 161 return false; | 166 return false; |
| 162 } | 167 } |
| 163 // Now that we have the singleton, take care of killing an older version, if | 168 // Now that we have the singleton, take care of killing an older version, if |
| 164 // it exists. | 169 // it exists. |
| 165 if (ShouldHandleOtherVersion() && !HandleOtherVersion()) | 170 if (ShouldHandleOtherVersion() && !HandleOtherVersion()) |
| 166 return false; | 171 return false; |
| 167 | 172 |
| 168 // TODO(sanjeevr): We can probably use the shared mem as the sole singleton | 173 // TODO(sanjeevr): We can probably use the shared mem as the sole singleton |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 shared_data->service_process_pid = base::GetCurrentProcId(); | 233 shared_data->service_process_pid = base::GetCurrentProcId(); |
| 229 shared_mem_service_data_.reset(shared_mem_service_data.release()); | 234 shared_mem_service_data_.reset(shared_mem_service_data.release()); |
| 230 return true; | 235 return true; |
| 231 } | 236 } |
| 232 | 237 |
| 233 | 238 |
| 234 std::string ServiceProcessState::GetAutoRunKey() { | 239 std::string ServiceProcessState::GetAutoRunKey() { |
| 235 return GetServiceProcessScopedName("_service_run"); | 240 return GetServiceProcessScopedName("_service_run"); |
| 236 } | 241 } |
| 237 | 242 |
| OLD | NEW |