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 <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 service_process_ready_event.Set( | 128 service_process_ready_event.Set( |
129 CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); | 129 CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); |
130 DWORD error = GetLastError(); | 130 DWORD error = GetLastError(); |
131 if ((error == ERROR_ALREADY_EXISTS) || (error == ERROR_ACCESS_DENIED)) | 131 if ((error == ERROR_ALREADY_EXISTS) || (error == ERROR_ACCESS_DENIED)) |
132 return false; | 132 return false; |
133 DCHECK(service_process_ready_event.IsValid()); | 133 DCHECK(service_process_ready_event.IsValid()); |
134 state_->ready_event.Set(service_process_ready_event.Take()); | 134 state_->ready_event.Set(service_process_ready_event.Take()); |
135 return true; | 135 return true; |
136 } | 136 } |
137 | 137 |
138 bool ServiceProcessState::SignalReady(base::SingleThreadTaskRunner* task_runner, | 138 bool ServiceProcessState::SignalReady( |
139 const base::Closure& terminate_task) { | 139 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 140 const base::Closure& terminate_task) { |
140 DCHECK(state_); | 141 DCHECK(state_); |
141 DCHECK(state_->ready_event.IsValid()); | 142 DCHECK(state_->ready_event.IsValid()); |
142 if (!SetEvent(state_->ready_event.Get())) { | 143 if (!SetEvent(state_->ready_event.Get())) { |
143 return false; | 144 return false; |
144 } | 145 } |
145 if (!terminate_task.is_null()) { | 146 if (!terminate_task.is_null()) { |
146 state_->terminate_monitor.reset( | 147 state_->terminate_monitor.reset( |
147 new ServiceProcessTerminateMonitor(terminate_task)); | 148 new ServiceProcessTerminateMonitor(terminate_task)); |
148 state_->terminate_monitor->Start(); | 149 state_->terminate_monitor->Start(); |
149 } | 150 } |
(...skipping 20 matching lines...) Expand all Loading... |
170 HKEY_CURRENT_USER, | 171 HKEY_CURRENT_USER, |
171 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); | 172 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); |
172 return base::win::RemoveCommandFromAutoRun( | 173 return base::win::RemoveCommandFromAutoRun( |
173 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); | 174 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); |
174 } | 175 } |
175 | 176 |
176 void ServiceProcessState::TearDownState() { | 177 void ServiceProcessState::TearDownState() { |
177 delete state_; | 178 delete state_; |
178 state_ = NULL; | 179 state_ = NULL; |
179 } | 180 } |
OLD | NEW |