OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/process/kill.h" | 5 #include "base/process/kill.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <io.h> | 8 #include <io.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 void EnsureProcessTerminated(Process process) { | 138 void EnsureProcessTerminated(Process process) { |
139 DCHECK(!process.is_current()); | 139 DCHECK(!process.is_current()); |
140 | 140 |
141 // If already signaled, then we are done! | 141 // If already signaled, then we are done! |
142 if (WaitForSingleObject(process.Handle(), 0) == WAIT_OBJECT_0) | 142 if (WaitForSingleObject(process.Handle(), 0) == WAIT_OBJECT_0) |
143 return; | 143 return; |
144 | 144 |
145 PostDelayedTaskWithTraits( | 145 PostDelayedTaskWithTraits( |
146 FROM_HERE, | 146 FROM_HERE, |
147 TaskTraits() | 147 {TaskPriority::BACKGROUND, TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
148 .WithPriority(TaskPriority::BACKGROUND) | |
149 .WithShutdownBehavior(TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | |
150 Bind( | 148 Bind( |
151 [](Process process) { | 149 [](Process process) { |
152 if (WaitForSingleObject(process.Handle(), 0) == WAIT_OBJECT_0) | 150 if (WaitForSingleObject(process.Handle(), 0) == WAIT_OBJECT_0) |
153 return; | 151 return; |
154 process.Terminate(kProcessKilledExitCode, false); | 152 process.Terminate(kProcessKilledExitCode, false); |
155 }, | 153 }, |
156 Passed(&process)), | 154 Passed(&process)), |
157 TimeDelta::FromSeconds(2)); | 155 TimeDelta::FromSeconds(2)); |
158 } | 156 } |
159 | 157 |
160 } // namespace base | 158 } // namespace base |
OLD | NEW |