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( | 138 bool ServiceProcessState::SignalReady(base::SingleThreadTaskRunner* task_runner, |
139 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 139 const base::Closure& terminate_task) { |
140 const base::Closure& terminate_task) { | |
141 DCHECK(state_); | 140 DCHECK(state_); |
142 DCHECK(state_->ready_event.IsValid()); | 141 DCHECK(state_->ready_event.IsValid()); |
143 if (!SetEvent(state_->ready_event.Get())) { | 142 if (!SetEvent(state_->ready_event.Get())) { |
144 return false; | 143 return false; |
145 } | 144 } |
146 if (!terminate_task.is_null()) { | 145 if (!terminate_task.is_null()) { |
147 state_->terminate_monitor.reset( | 146 state_->terminate_monitor.reset( |
148 new ServiceProcessTerminateMonitor(terminate_task)); | 147 new ServiceProcessTerminateMonitor(terminate_task)); |
149 state_->terminate_monitor->Start(); | 148 state_->terminate_monitor->Start(); |
150 } | 149 } |
(...skipping 20 matching lines...) Expand all Loading... |
171 HKEY_CURRENT_USER, | 170 HKEY_CURRENT_USER, |
172 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); | 171 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); |
173 return base::win::RemoveCommandFromAutoRun( | 172 return base::win::RemoveCommandFromAutoRun( |
174 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); | 173 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); |
175 } | 174 } |
176 | 175 |
177 void ServiceProcessState::TearDownState() { | 176 void ServiceProcessState::TearDownState() { |
178 delete state_; | 177 delete state_; |
179 state_ = NULL; | 178 state_ = NULL; |
180 } | 179 } |
OLD | NEW |