OLD | NEW |
1 // Copyright (c) 2011 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_util.h" | 5 #include "base/process/kill.h" |
| 6 |
| 7 #include "base/process/process_iterator.h" |
6 | 8 |
7 namespace base { | 9 namespace base { |
8 | 10 |
9 bool KillProcesses(const FilePath::StringType& executable_name, int exit_code, | 11 bool KillProcesses(const FilePath::StringType& executable_name, |
| 12 int exit_code, |
10 const ProcessFilter* filter) { | 13 const ProcessFilter* filter) { |
11 bool result = true; | 14 bool result = true; |
12 NamedProcessIterator iter(executable_name, filter); | 15 NamedProcessIterator iter(executable_name, filter); |
13 while (const ProcessEntry* entry = iter.NextProcessEntry()) { | 16 while (const ProcessEntry* entry = iter.NextProcessEntry()) { |
14 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
15 result &= KillProcessById(entry->pid(), exit_code, true); | 18 result &= KillProcessById(entry->pid(), exit_code, true); |
16 #else | 19 #else |
17 result &= KillProcess(entry->pid(), exit_code, true); | 20 result &= KillProcess(entry->pid(), exit_code, true); |
18 #endif | 21 #endif |
19 } | 22 } |
20 return result; | 23 return result; |
21 } | 24 } |
22 | 25 |
23 } // namespace base | 26 } // namespace base |
OLD | NEW |