diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 03:25:15 +0000 |
commit | 176aa48371da91eb98d675d87b4e70c7b26d696f (patch) | |
tree | 4c972de6ecd5a54650ab1dc7d421187f5d25834f /base/process_win.cc | |
parent | 9a3f0ac2899139ace97e399015259d028b4d5704 (diff) | |
download | chromium_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_win.cc')
-rw-r--r-- | base/process_win.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/base/process_win.cc b/base/process_win.cc index 7a60854..697a020 100644 --- a/base/process_win.cc +++ b/base/process_win.cc @@ -7,6 +7,21 @@ #include "base/process_util.h" #include "base/scoped_ptr.h" +namespace base { + +void Process::Close() { + if (!process_) + return; + ::CloseHandle(process_); + process_ = NULL; +} + +void Process::Terminate(int result_code) { + if (!process_) + return; + ::TerminateProcess(process_, result_code); +} + bool Process::IsProcessBackgrounded() const { DCHECK(process_); DWORD priority = GetPriorityClass(process_); @@ -43,9 +58,9 @@ bool Process::ReduceWorkingSet() { // The intended algorithm is: // TargetWorkingSetSize = (LastWorkingSet/2 + CurrentWorkingSet) /2 - scoped_ptr<process_util::ProcessMetrics> metrics( - process_util::ProcessMetrics::CreateProcessMetrics(process_)); - process_util::WorkingSetKBytes working_set; + scoped_ptr<ProcessMetrics> metrics( + ProcessMetrics::CreateProcessMetrics(process_)); + WorkingSetKBytes working_set; if (!metrics->GetWorkingSetKBytes(&working_set)) return false; @@ -96,7 +111,7 @@ int32 Process::pid() const { if (process_ == 0) return 0; - return process_util::GetProcId(process_); + return GetProcId(process_); } bool Process::is_current() const { @@ -108,3 +123,4 @@ Process Process::Current() { return Process(GetCurrentProcess()); } +} // namespace base |