Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: base/process_util.h

Issue 18555002: Split out process killing functions from base/process_util.h into base/process/kill.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/kill_win.cc ('k') | base/process_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util.h
diff --git a/base/process_util.h b/base/process_util.h
index fdc9cf977aaa916f9667f336ca0e7f224db11d25..08add291b149fa37db43b6112a6df2a669bf64be 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -37,6 +37,7 @@ typedef struct _malloc_zone_t malloc_zone_t;
#include "base/files/file_path.h"
#include "base/process.h"
#include "base/process/memory.h"
+#include "base/process/kill.h"
#include "base/process/process_iterator.h"
#include "base/process/process_metrics.h"
@@ -48,18 +49,6 @@ class CommandLine;
namespace base {
-// Return status values from GetTerminationStatus. Don't use these as
-// exit code arguments to KillProcess*(), use platform/application
-// specific values instead.
-enum TerminationStatus {
- TERMINATION_STATUS_NORMAL_TERMINATION, // zero exit status
- TERMINATION_STATUS_ABNORMAL_TERMINATION, // non-zero exit status
- TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill
- TERMINATION_STATUS_PROCESS_CRASHED, // e.g. Segmentation fault
- TERMINATION_STATUS_STILL_RUNNING, // child hasn't exited yet
- TERMINATION_STATUS_MAX_ENUM
-};
-
#if defined(OS_WIN)
// Output multi-process printf, cout, cerr, etc to the cmd.exe console that ran
// chrome. This is not thread-safe: only call from main thread.
@@ -345,115 +334,6 @@ BASE_EXPORT bool GetAppOutputWithExitCode(const CommandLine& cl,
std::string* output, int* exit_code);
#endif // defined(OS_POSIX)
-// Attempts to kill all the processes on the current machine that were launched
-// from the given executable name, ending them with the given exit code. If
-// filter is non-null, then only processes selected by the filter are killed.
-// Returns true if all processes were able to be killed off, false if at least
-// one couldn't be killed.
-BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name,
- int exit_code, const ProcessFilter* filter);
-
-// Attempts to kill the process identified by the given process
-// entry structure, giving it the specified exit code. If |wait| is true, wait
-// for the process to be actually terminated before returning.
-// Returns true if this is successful, false otherwise.
-BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait);
-
-#if defined(OS_POSIX)
-// Attempts to kill the process group identified by |process_group_id|. Returns
-// true on success.
-BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id);
-#endif // defined(OS_POSIX)
-
-#if defined(OS_WIN)
-BASE_EXPORT bool KillProcessById(ProcessId process_id, int exit_code,
- bool wait);
-#endif // defined(OS_WIN)
-
-// Get the termination status of the process by interpreting the
-// circumstances of the child process' death. |exit_code| is set to
-// the status returned by waitpid() on POSIX, and from
-// GetExitCodeProcess() on Windows. |exit_code| may be NULL if the
-// caller is not interested in it. Note that on Linux, this function
-// will only return a useful result the first time it is called after
-// the child exits (because it will reap the child and the information
-// will no longer be available).
-BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle,
- int* exit_code);
-
-#if defined(OS_POSIX)
-// Wait for the process to exit and get the termination status. See
-// GetTerminationStatus for more information. On POSIX systems, we can't call
-// WaitForExitCode and then GetTerminationStatus as the child will be reaped
-// when WaitForExitCode return and this information will be lost.
-BASE_EXPORT TerminationStatus WaitForTerminationStatus(ProcessHandle handle,
- int* exit_code);
-#endif // defined(OS_POSIX)
-
-// Waits for process to exit. On POSIX systems, if the process hasn't been
-// signaled then puts the exit code in |exit_code|; otherwise it's considered
-// a failure. On Windows |exit_code| is always filled. Returns true on success,
-// and closes |handle| in any case.
-BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code);
-
-// Waits for process to exit. If it did exit within |timeout_milliseconds|,
-// then puts the exit code in |exit_code|, and returns true.
-// In POSIX systems, if the process has been signaled then |exit_code| is set
-// to -1. Returns false on failure (the caller is then responsible for closing
-// |handle|).
-// The caller is always responsible for closing the |handle|.
-BASE_EXPORT bool WaitForExitCodeWithTimeout(ProcessHandle handle,
- int* exit_code,
- base::TimeDelta timeout);
-
-// Wait for all the processes based on the named executable to exit. If filter
-// is non-null, then only processes selected by the filter are waited on.
-// Returns after all processes have exited or wait_milliseconds have expired.
-// Returns true if all the processes exited, false otherwise.
-BASE_EXPORT bool WaitForProcessesToExit(
- const FilePath::StringType& executable_name,
- base::TimeDelta wait,
- const ProcessFilter* filter);
-
-// Wait for a single process to exit. Return true if it exited cleanly within
-// the given time limit. On Linux |handle| must be a child process, however
-// on Mac and Windows it can be any process.
-BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle,
- base::TimeDelta wait);
-
-// Waits a certain amount of time (can be 0) for all the processes with a given
-// executable name to exit, then kills off any of them that are still around.
-// If filter is non-null, then only processes selected by the filter are waited
-// on. Killed processes are ended with the given exit code. Returns false if
-// any processes needed to be killed, true if they all exited cleanly within
-// the wait_milliseconds delay.
-BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name,
- base::TimeDelta wait,
- int exit_code,
- const ProcessFilter* filter);
-
-// This method ensures that the specified process eventually terminates, and
-// then it closes the given process handle.
-//
-// It assumes that the process has already been signalled to exit, and it
-// begins by waiting a small amount of time for it to exit. If the process
-// does not appear to have exited, then this function starts to become
-// aggressive about ensuring that the process terminates.
-//
-// On Linux this method does not block the calling thread.
-// On OS X this method may block for up to 2 seconds.
-//
-// NOTE: The process handle must have been opened with the PROCESS_TERMINATE
-// and SYNCHRONIZE permissions.
-//
-BASE_EXPORT void EnsureProcessTerminated(ProcessHandle process_handle);
-
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
-// The nicer version of EnsureProcessTerminated() that is patient and will
-// wait for |process_handle| to finish and then reap it.
-BASE_EXPORT void EnsureProcessGetsReaped(ProcessHandle process_handle);
-#endif
-
// If supported on the platform, and the user has sufficent rights, increase
// the current process's scheduling priority to a high priority.
BASE_EXPORT void RaiseProcessToHighPriority();
« no previous file with comments | « base/process/kill_win.cc ('k') | base/process_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698