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

Unified Diff: base/process_win.cc

Issue 10895: Add Terminate() to the Process object, have RenderProcessHost use this to avo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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_util_win.cc ('k') | base/run_all_perftests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_win.cc
===================================================================
--- base/process_win.cc (revision 5371)
+++ base/process_win.cc (working copy)
@@ -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 @@
// 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 @@
if (process_ == 0)
return 0;
- return process_util::GetProcId(process_);
+ return GetProcId(process_);
}
bool Process::is_current() const {
@@ -108,3 +123,4 @@
return Process(GetCurrentProcess());
}
+} // namespace base
« no previous file with comments | « base/process_util_win.cc ('k') | base/run_all_perftests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698