| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 service_process_ready_event.Set( | 125 service_process_ready_event.Set( |
| 126 CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); | 126 CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); |
| 127 DWORD error = GetLastError(); | 127 DWORD error = GetLastError(); |
| 128 if ((error == ERROR_ALREADY_EXISTS) || (error == ERROR_ACCESS_DENIED)) | 128 if ((error == ERROR_ALREADY_EXISTS) || (error == ERROR_ACCESS_DENIED)) |
| 129 return false; | 129 return false; |
| 130 DCHECK(service_process_ready_event.IsValid()); | 130 DCHECK(service_process_ready_event.IsValid()); |
| 131 state_->ready_event.Set(service_process_ready_event.Take()); | 131 state_->ready_event.Set(service_process_ready_event.Take()); |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool ServiceProcessState::SignalReady( | 135 bool ServiceProcessState::SignalReady(base::SingleThreadTaskRunner* task_runner, |
| 136 base::MessageLoopProxy* message_loop_proxy, | 136 const base::Closure& terminate_task) { |
| 137 const base::Closure& terminate_task) { | |
| 138 DCHECK(state_); | 137 DCHECK(state_); |
| 139 DCHECK(state_->ready_event.IsValid()); | 138 DCHECK(state_->ready_event.IsValid()); |
| 140 if (!SetEvent(state_->ready_event.Get())) { | 139 if (!SetEvent(state_->ready_event.Get())) { |
| 141 return false; | 140 return false; |
| 142 } | 141 } |
| 143 if (!terminate_task.is_null()) { | 142 if (!terminate_task.is_null()) { |
| 144 state_->terminate_monitor.reset( | 143 state_->terminate_monitor.reset( |
| 145 new ServiceProcessTerminateMonitor(terminate_task)); | 144 new ServiceProcessTerminateMonitor(terminate_task)); |
| 146 state_->terminate_monitor->Start(); | 145 state_->terminate_monitor->Start(); |
| 147 } | 146 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 168 HKEY_CURRENT_USER, | 167 HKEY_CURRENT_USER, |
| 169 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); | 168 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); |
| 170 return base::win::RemoveCommandFromAutoRun( | 169 return base::win::RemoveCommandFromAutoRun( |
| 171 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); | 170 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); |
| 172 } | 171 } |
| 173 | 172 |
| 174 void ServiceProcessState::TearDownState() { | 173 void ServiceProcessState::TearDownState() { |
| 175 delete state_; | 174 delete state_; |
| 176 state_ = NULL; | 175 state_ = NULL; |
| 177 } | 176 } |
| OLD | NEW |