| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_posix.h" | 5 #include "chrome/common/service_process_util_posix.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (state_->running_lock.get() == NULL) { | 175 if (state_->running_lock.get() == NULL) { |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 #endif | 178 #endif |
| 179 state_->terminate_monitor.reset( | 179 state_->terminate_monitor.reset( |
| 180 new ServiceProcessTerminateMonitor(terminate_task)); | 180 new ServiceProcessTerminateMonitor(terminate_task)); |
| 181 if (pipe(state_->sockets) < 0) { | 181 if (pipe(state_->sockets) < 0) { |
| 182 DPLOG(ERROR) << "pipe"; | 182 DPLOG(ERROR) << "pipe"; |
| 183 return false; | 183 return false; |
| 184 } | 184 } |
| 185 base::WaitableEvent signal_ready(true, false); | 185 base::WaitableEvent signal_ready( |
| 186 base::WaitableEvent::ResetPolicy::MANUAL, |
| 187 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 186 bool success = false; | 188 bool success = false; |
| 187 | 189 |
| 188 task_runner->PostTask(FROM_HERE, | 190 task_runner->PostTask(FROM_HERE, |
| 189 base::Bind(&ServiceProcessState::StateData::SignalReady, | 191 base::Bind(&ServiceProcessState::StateData::SignalReady, |
| 190 state_, &signal_ready, &success)); | 192 state_, &signal_ready, &success)); |
| 191 signal_ready.Wait(); | 193 signal_ready.Wait(); |
| 192 return success; | 194 return success; |
| 193 } | 195 } |
| 194 | 196 |
| 195 void ServiceProcessState::TearDownState() { | 197 void ServiceProcessState::TearDownState() { |
| 196 if (state_) { | 198 if (state_) { |
| 197 state_->Release(); | 199 state_->Release(); |
| 198 state_ = NULL; | 200 state_ = NULL; |
| 199 } | 201 } |
| 200 } | 202 } |
| OLD | NEW |