| 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/test/chrome_process_util.h" | 5 #include "chrome/test/chrome_process_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 ChromeProcessList::const_iterator it; | 23 ChromeProcessList::const_iterator it; |
| 24 for (it = process_pids.begin(); it != process_pids.end(); ++it) { | 24 for (it = process_pids.begin(); it != process_pids.end(); ++it) { |
| 25 base::ProcessHandle handle; | 25 base::ProcessHandle handle; |
| 26 if (!base::OpenPrivilegedProcessHandle(*it, &handle)) { | 26 if (!base::OpenPrivilegedProcessHandle(*it, &handle)) { |
| 27 // Ignore processes for which we can't open the handle. We don't | 27 // Ignore processes for which we can't open the handle. We don't |
| 28 // guarantee that all processes will terminate, only try to do so. | 28 // guarantee that all processes will terminate, only try to do so. |
| 29 continue; | 29 continue; |
| 30 } | 30 } |
| 31 | 31 |
| 32 base::KillProcess(handle, ResultCodes::KILLED, true); | 32 base::KillProcess(handle, content::RESULT_CODE_KILLED, true); |
| 33 base::CloseProcessHandle(handle); | 33 base::CloseProcessHandle(handle); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 class ChildProcessFilter : public base::ProcessFilter { | 37 class ChildProcessFilter : public base::ProcessFilter { |
| 38 public: | 38 public: |
| 39 explicit ChildProcessFilter(base::ProcessId parent_pid) | 39 explicit ChildProcessFilter(base::ProcessId parent_pid) |
| 40 : parent_pids_(&parent_pid, (&parent_pid) + 1) {} | 40 : parent_pids_(&parent_pid, (&parent_pid) + 1) {} |
| 41 | 41 |
| 42 explicit ChildProcessFilter(std::vector<base::ProcessId> parent_pids) | 42 explicit ChildProcessFilter(std::vector<base::ProcessId> parent_pids) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 base::ProcessHandle process) { | 125 base::ProcessHandle process) { |
| 126 #if !defined(OS_MACOSX) | 126 #if !defined(OS_MACOSX) |
| 127 process_metrics_.reset( | 127 process_metrics_.reset( |
| 128 base::ProcessMetrics::CreateProcessMetrics(process)); | 128 base::ProcessMetrics::CreateProcessMetrics(process)); |
| 129 #else | 129 #else |
| 130 process_metrics_.reset( | 130 process_metrics_.reset( |
| 131 base::ProcessMetrics::CreateProcessMetrics(process, NULL)); | 131 base::ProcessMetrics::CreateProcessMetrics(process, NULL)); |
| 132 #endif | 132 #endif |
| 133 process_handle_ = process; | 133 process_handle_ = process; |
| 134 } | 134 } |
| OLD | NEW |