OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool GetAppOutputRestricted(const CommandLine& cl, | 176 bool GetAppOutputRestricted(const CommandLine& cl, |
177 std::string* output, size_t max_output); | 177 std::string* output, size_t max_output); |
178 #endif | 178 #endif |
179 | 179 |
180 // Used to filter processes by process ID. | 180 // Used to filter processes by process ID. |
181 class ProcessFilter { | 181 class ProcessFilter { |
182 public: | 182 public: |
183 // Returns true to indicate set-inclusion and false otherwise. This method | 183 // Returns true to indicate set-inclusion and false otherwise. This method |
184 // should not have side-effects and should be idempotent. | 184 // should not have side-effects and should be idempotent. |
185 virtual bool Includes(ProcessId pid, ProcessId parent_pid) const = 0; | 185 virtual bool Includes(ProcessId pid, ProcessId parent_pid) const = 0; |
186 virtual ~ProcessFilter() { } | |
187 }; | 186 }; |
188 | 187 |
189 // Returns the number of processes on the machine that are running from the | 188 // Returns the number of processes on the machine that are running from the |
190 // given executable name. If filter is non-null, then only processes selected | 189 // given executable name. If filter is non-null, then only processes selected |
191 // by the filter will be counted. | 190 // by the filter will be counted. |
192 int GetProcessCount(const std::wstring& executable_name, | 191 int GetProcessCount(const std::wstring& executable_name, |
193 const ProcessFilter* filter); | 192 const ProcessFilter* filter); |
194 | 193 |
195 // Attempts to kill all the processes on the current machine that were launched | 194 // Attempts to kill all the processes on the current machine that were launched |
196 // from the given executable name, ending them with the given exit code. If | 195 // from the given executable name, ending them with the given exit code. If |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // instance running inside the parent. The parent's Breakpad instance should | 459 // instance running inside the parent. The parent's Breakpad instance should |
461 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 460 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
462 // in the child after forking will restore the standard exception handler. | 461 // in the child after forking will restore the standard exception handler. |
463 // See http://crbug.com/20371/ for more details. | 462 // See http://crbug.com/20371/ for more details. |
464 void RestoreDefaultExceptionHandler(); | 463 void RestoreDefaultExceptionHandler(); |
465 #endif | 464 #endif |
466 | 465 |
467 } // namespace base | 466 } // namespace base |
468 | 467 |
469 #endif // BASE_PROCESS_UTIL_H_ | 468 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |