summaryrefslogtreecommitdiffstats
path: root/base/process.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
commit176aa48371da91eb98d675d87b4e70c7b26d696f (patch)
tree4c972de6ecd5a54650ab1dc7d421187f5d25834f /base/process.h
parent9a3f0ac2899139ace97e399015259d028b4d5704 (diff)
downloadchromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.zip
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.gz
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.bz2
Add Terminate() to the Process object, have RenderProcessHost use this to avoid some more Windows specific code.
Move Process and SharedMemory into the base namespace (most changes). Review URL: http://codereview.chromium.org/10895 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
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_