| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return false; | 121 return false; |
| 122 DCHECK(service_process_ready_event.IsValid()); | 122 DCHECK(service_process_ready_event.IsValid()); |
| 123 state_->ready_event.Set(service_process_ready_event.Take()); | 123 state_->ready_event.Set(service_process_ready_event.Take()); |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool ServiceProcessState::SignalReady( | 127 bool ServiceProcessState::SignalReady( |
| 128 base::MessageLoopProxy* message_loop_proxy, Task* shutdown_task) { | 128 base::MessageLoopProxy* message_loop_proxy, Task* shutdown_task) { |
| 129 DCHECK(state_); | 129 DCHECK(state_); |
| 130 DCHECK(state_->ready_event.IsValid()); | 130 DCHECK(state_->ready_event.IsValid()); |
| 131 scoped_ptr<Task> scoped_shutdown_task(shutdown_task); |
| 131 if (!SetEvent(state_->ready_event.Get())) { | 132 if (!SetEvent(state_->ready_event.Get())) { |
| 132 return false; | 133 return false; |
| 133 } | 134 } |
| 134 if (shutdown_task) { | 135 if (shutdown_task) { |
| 135 state_->shutdown_monitor.reset( | 136 state_->shutdown_monitor.reset( |
| 136 new ServiceProcessShutdownMonitor(shutdown_task)); | 137 new ServiceProcessShutdownMonitor(scoped_shutdown_task.release())); |
| 137 state_->shutdown_monitor->Start(); | 138 state_->shutdown_monitor->Start(); |
| 138 } | 139 } |
| 139 return true; | 140 return true; |
| 140 } | 141 } |
| 141 | 142 |
| 142 bool ServiceProcessState::AddToAutoRun() { | 143 bool ServiceProcessState::AddToAutoRun() { |
| 143 DCHECK(autorun_command_line_.get()); | 144 DCHECK(autorun_command_line_.get()); |
| 144 // Remove the old autorun value first because we changed the naming scheme | 145 // Remove the old autorun value first because we changed the naming scheme |
| 145 // for the autorun value name. | 146 // for the autorun value name. |
| 146 base::win::RemoveCommandFromAutoRun( | 147 base::win::RemoveCommandFromAutoRun( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 base::win::RemoveCommandFromAutoRun( | 158 base::win::RemoveCommandFromAutoRun( |
| 158 HKEY_CURRENT_USER, UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); | 159 HKEY_CURRENT_USER, UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); |
| 159 return base::win::RemoveCommandFromAutoRun( | 160 return base::win::RemoveCommandFromAutoRun( |
| 160 HKEY_CURRENT_USER, UTF8ToWide(GetServiceProcessAutoRunKey())); | 161 HKEY_CURRENT_USER, UTF8ToWide(GetServiceProcessAutoRunKey())); |
| 161 } | 162 } |
| 162 | 163 |
| 163 void ServiceProcessState::TearDownState() { | 164 void ServiceProcessState::TearDownState() { |
| 164 delete state_; | 165 delete state_; |
| 165 state_ = NULL; | 166 state_ = NULL; |
| 166 } | 167 } |
| OLD | NEW |