summaryrefslogtreecommitdiffstats
path: root/base/process.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/process.h')
-rw-r--r--base/process.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/base/process.h b/base/process.h
index 806b1de..7be16e0 100644
--- a/base/process.h
+++ b/base/process.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_PROCESS_H__
-#define BASE_PROCESS_H__
+#ifndef BASE_PROCESS_H_
+#define BASE_PROCESS_H_
#include "base/basictypes.h"
@@ -11,6 +11,8 @@
#include <windows.h>
#endif
+namespace base {
+
// ProcessHandle is a platform specific type which represents the underlying OS
// handle to a process.
#if defined(OS_WIN)
@@ -20,9 +22,6 @@ typedef HANDLE ProcessHandle;
typedef int ProcessHandle;
#endif
-// A Process
-// TODO(mbelshe): Replace existing code which uses the ProcessHandle w/ the
-// Process object where relevant.
class Process {
public:
Process() : process_(0), last_working_set_size_(0) {}
@@ -43,13 +42,13 @@ class Process {
// Is the this process the current process.
bool is_current() const;
- // Close the Process Handle.
- void Close() {
-#ifdef OS_WIN
- CloseHandle(process_);
-#endif
- process_ = 0;
- }
+ // Close the process handle. This will not terminate the process.
+ void Close();
+
+ // Terminates the process with extreme prejudice. The given result code will
+ // be the exit code of the process. If the process has already exited, this
+ // will do nothing.
+ void Terminate(int result_code);
// A process is backgrounded when it's priority is lower than normal.
// Return true if this process is backgrounded, false otherwise.
@@ -85,5 +84,7 @@ class Process {
size_t last_working_set_size_;
};
-#endif // BASE_PROCESS_H__
+} // namespace base
+
+#endif // BASE_PROCESS_H_