OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill | 131 TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill |
132 TERMINATION_STATUS_PROCESS_CRASHED, // e.g. Segmentation fault | 132 TERMINATION_STATUS_PROCESS_CRASHED, // e.g. Segmentation fault |
133 TERMINATION_STATUS_STILL_RUNNING, // child hasn't exited yet | 133 TERMINATION_STATUS_STILL_RUNNING, // child hasn't exited yet |
134 TERMINATION_STATUS_MAX_ENUM | 134 TERMINATION_STATUS_MAX_ENUM |
135 }; | 135 }; |
136 | 136 |
137 #if defined(USE_LINUX_BREAKPAD) | 137 #if defined(USE_LINUX_BREAKPAD) |
138 BASE_EXPORT extern size_t g_oom_size; | 138 BASE_EXPORT extern size_t g_oom_size; |
139 #endif | 139 #endif |
140 | 140 |
| 141 #if defined(OS_WIN) |
| 142 // Output multi-process printf, cout, cerr, etc to the cmd.exe console that ran |
| 143 // chrome. This is not thread-safe: only call from main thread. |
| 144 BASE_EXPORT void RouteStdioToConsole(); |
| 145 #endif |
| 146 |
141 // Returns the id of the current process. | 147 // Returns the id of the current process. |
142 BASE_EXPORT ProcessId GetCurrentProcId(); | 148 BASE_EXPORT ProcessId GetCurrentProcId(); |
143 | 149 |
144 // Returns the ProcessHandle of the current process. | 150 // Returns the ProcessHandle of the current process. |
145 BASE_EXPORT ProcessHandle GetCurrentProcessHandle(); | 151 BASE_EXPORT ProcessHandle GetCurrentProcessHandle(); |
146 | 152 |
147 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
148 // Returns the module handle to which an address belongs. The reference count | 154 // Returns the module handle to which an address belongs. The reference count |
149 // of the module is not incremented. | 155 // of the module is not incremented. |
150 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); | 156 BASE_EXPORT HMODULE GetModuleFromAddress(void* address); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // Turns on process termination if memory runs out. | 831 // Turns on process termination if memory runs out. |
826 BASE_EXPORT void EnableTerminationOnOutOfMemory(); | 832 BASE_EXPORT void EnableTerminationOnOutOfMemory(); |
827 | 833 |
828 #if defined(OS_MACOSX) | 834 #if defined(OS_MACOSX) |
829 // Exposed for testing. | 835 // Exposed for testing. |
830 BASE_EXPORT malloc_zone_t* GetPurgeableZone(); | 836 BASE_EXPORT malloc_zone_t* GetPurgeableZone(); |
831 #endif // defined(OS_MACOSX) | 837 #endif // defined(OS_MACOSX) |
832 | 838 |
833 // Enables stack dump to console output on exception and signals. | 839 // Enables stack dump to console output on exception and signals. |
834 // When enabled, the process will quit immediately. This is meant to be used in | 840 // When enabled, the process will quit immediately. This is meant to be used in |
835 // unit_tests only! | 841 // unit_tests only! This is not thread-safe: only call from main thread. |
836 BASE_EXPORT bool EnableInProcessStackDumping(); | 842 BASE_EXPORT bool EnableInProcessStackDumping(); |
837 | 843 |
838 // If supported on the platform, and the user has sufficent rights, increase | 844 // If supported on the platform, and the user has sufficent rights, increase |
839 // the current process's scheduling priority to a high priority. | 845 // the current process's scheduling priority to a high priority. |
840 BASE_EXPORT void RaiseProcessToHighPriority(); | 846 BASE_EXPORT void RaiseProcessToHighPriority(); |
841 | 847 |
842 #if defined(OS_MACOSX) | 848 #if defined(OS_MACOSX) |
843 // Restore the default exception handler, setting it to Apple Crash Reporter | 849 // Restore the default exception handler, setting it to Apple Crash Reporter |
844 // (ReportCrash). When forking and execing a new process, the child will | 850 // (ReportCrash). When forking and execing a new process, the child will |
845 // inherit the parent's exception ports, which may be set to the Breakpad | 851 // inherit the parent's exception ports, which may be set to the Breakpad |
846 // instance running inside the parent. The parent's Breakpad instance should | 852 // instance running inside the parent. The parent's Breakpad instance should |
847 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 853 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
848 // in the child after forking will restore the standard exception handler. | 854 // in the child after forking will restore the standard exception handler. |
849 // See http://crbug.com/20371/ for more details. | 855 // See http://crbug.com/20371/ for more details. |
850 void RestoreDefaultExceptionHandler(); | 856 void RestoreDefaultExceptionHandler(); |
851 #endif // defined(OS_MACOSX) | 857 #endif // defined(OS_MACOSX) |
852 | 858 |
853 } // namespace base | 859 } // namespace base |
854 | 860 |
855 #endif // BASE_PROCESS_UTIL_H_ | 861 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |