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
diff --git a/base/process.h b/base/process.h
index 806b1de..7be16e08 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 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 @@
   // 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 @@
   size_t last_working_set_size_;
 };
 
-#endif  // BASE_PROCESS_H__
+}  // namespace base
+
+#endif  // BASE_PROCESS_H_