OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool LaunchApp(const std::vector<std::string>& argv, | 117 bool LaunchApp(const std::vector<std::string>& argv, |
118 const file_handle_mapping_vector& fds_to_remap, | 118 const file_handle_mapping_vector& fds_to_remap, |
119 bool wait, ProcessHandle* process_handle); | 119 bool wait, ProcessHandle* process_handle); |
120 #endif | 120 #endif |
121 | 121 |
122 // Execute the application specified by cl. This function delegates to one | 122 // Execute the application specified by cl. This function delegates to one |
123 // of the above two platform-specific functions. | 123 // of the above two platform-specific functions. |
124 bool LaunchApp(const CommandLine& cl, | 124 bool LaunchApp(const CommandLine& cl, |
125 bool wait, bool start_hidden, ProcessHandle* process_handle); | 125 bool wait, bool start_hidden, ProcessHandle* process_handle); |
126 | 126 |
| 127 #if defined(OS_POSIX) |
| 128 // Execute the application specified by |cl| and wait for it to exit. Store |
| 129 // the output (stdout and stderr) in |output|. Returns true on success |
| 130 // (application launched and exited cleanly, with exit code indicating success). |
| 131 // |output| is modified only when the function finished successfully. |
| 132 bool GetAppOutput(const CommandLine& cl, std::string* output); |
| 133 #endif // defined(OS_POSIX) |
| 134 |
127 // Used to filter processes by process ID. | 135 // Used to filter processes by process ID. |
128 class ProcessFilter { | 136 class ProcessFilter { |
129 public: | 137 public: |
130 // Returns true to indicate set-inclusion and false otherwise. This method | 138 // Returns true to indicate set-inclusion and false otherwise. This method |
131 // should not have side-effects and should be idempotent. | 139 // should not have side-effects and should be idempotent. |
132 virtual bool Includes(ProcessId pid, ProcessId parent_pid) const = 0; | 140 virtual bool Includes(ProcessId pid, ProcessId parent_pid) const = 0; |
133 virtual ~ProcessFilter() { } | 141 virtual ~ProcessFilter() { } |
134 }; | 142 }; |
135 | 143 |
136 // Returns the number of processes on the machine that are running from the | 144 // Returns the number of processes on the machine that are running from the |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 361 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
354 void EnableTerminationOnHeapCorruption(); | 362 void EnableTerminationOnHeapCorruption(); |
355 | 363 |
356 // If supported on the platform, and the user has sufficent rights, increase | 364 // If supported on the platform, and the user has sufficent rights, increase |
357 // the current process's scheduling priority to a high priority. | 365 // the current process's scheduling priority to a high priority. |
358 void RaiseProcessToHighPriority(); | 366 void RaiseProcessToHighPriority(); |
359 | 367 |
360 } // namespace base | 368 } // namespace base |
361 | 369 |
362 #endif // BASE_PROCESS_UTIL_H_ | 370 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |