| 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/singleton.h" | 
|    9 #include "base/string16.h" |   10 #include "base/string16.h" | 
|   10 #include "base/string_util.h" |   11 #include "base/string_util.h" | 
|   11 #include "base/utf_string_conversions.h" |   12 #include "base/utf_string_conversions.h" | 
|   12 #include "chrome/common/chrome_constants.h" |   13 #include "chrome/common/chrome_constants.h" | 
|   13 #include "chrome/common/chrome_paths.h" |   14 #include "chrome/common/chrome_paths.h" | 
|   14 #include "chrome/common/chrome_version_info.h" |   15 #include "chrome/common/chrome_version_info.h" | 
|   15 #include "chrome/common/service_process_util.h" |   16 #include "chrome/common/service_process_util.h" | 
|   16 #include "chrome/installer/util/version.h" |   17 #include "chrome/installer/util/version.h" | 
|   17  |   18  | 
|   18 namespace { |   19 namespace { | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  149   return pid; |  150   return pid; | 
|  150 } |  151 } | 
|  151  |  152  | 
|  152 ServiceProcessState::ServiceProcessState() : state_(NULL) { |  153 ServiceProcessState::ServiceProcessState() : state_(NULL) { | 
|  153 } |  154 } | 
|  154  |  155  | 
|  155 ServiceProcessState::~ServiceProcessState() { |  156 ServiceProcessState::~ServiceProcessState() { | 
|  156   TearDownState(); |  157   TearDownState(); | 
|  157 } |  158 } | 
|  158  |  159  | 
 |  160 // static | 
 |  161 ServiceProcessState* ServiceProcessState::GetInstance() { | 
 |  162   return Singleton<ServiceProcessState>::get(); | 
 |  163 } | 
 |  164  | 
|  159 bool ServiceProcessState::Initialize() { |  165 bool ServiceProcessState::Initialize() { | 
|  160   if (!TakeSingletonLock()) { |  166   if (!TakeSingletonLock()) { | 
|  161     return false; |  167     return false; | 
|  162   } |  168   } | 
|  163   // Now that we have the singleton, take care of killing an older version, if |  169   // Now that we have the singleton, take care of killing an older version, if | 
|  164   // it exists. |  170   // it exists. | 
|  165   if (ShouldHandleOtherVersion() && !HandleOtherVersion()) |  171   if (ShouldHandleOtherVersion() && !HandleOtherVersion()) | 
|  166     return false; |  172     return false; | 
|  167  |  173  | 
|  168   // TODO(sanjeevr): We can probably use the shared mem as the sole singleton |  174   // 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(); |  234   shared_data->service_process_pid = base::GetCurrentProcId(); | 
|  229   shared_mem_service_data_.reset(shared_mem_service_data.release()); |  235   shared_mem_service_data_.reset(shared_mem_service_data.release()); | 
|  230   return true; |  236   return true; | 
|  231 } |  237 } | 
|  232  |  238  | 
|  233  |  239  | 
|  234 std::string ServiceProcessState::GetAutoRunKey() { |  240 std::string ServiceProcessState::GetAutoRunKey() { | 
|  235   return GetServiceProcessScopedName("_service_run"); |  241   return GetServiceProcessScopedName("_service_run"); | 
|  236 } |  242 } | 
|  237  |  243  | 
| OLD | NEW |