diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 01:23:11 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 01:23:11 +0000 |
commit | dfe1486216ccb5942ef52bafa30d361638183eea (patch) | |
tree | 0d8c2152090b9a0a2b3e421fafae2d9cd6311aff /base/process_util_win.cc | |
parent | 3ac10dd155f52f6cfebe40b18806f50bda71ca46 (diff) | |
download | chromium_src-dfe1486216ccb5942ef52bafa30d361638183eea.zip chromium_src-dfe1486216ccb5942ef52bafa30d361638183eea.tar.gz chromium_src-dfe1486216ccb5942ef52bafa30d361638183eea.tar.bz2 |
POSIX: Get render_process_host to build.
This is an adopted CL from Evan. Original:
http://codereview.chromium.org/14504
(see original for review comments etc)
Review URL: http://codereview.chromium.org/16814
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_win.cc')
-rw-r--r-- | base/process_util_win.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc index a69f5d5..f1fd72c 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -153,21 +153,24 @@ bool LaunchApp(const CommandLine& cl, // entry structure, giving it the specified exit code. // Returns true if this is successful, false otherwise. bool KillProcess(int process_id, int exit_code, bool wait) { - bool result = false; HANDLE process = OpenProcess(PROCESS_TERMINATE | SYNCHRONIZE, FALSE, // Don't inherit handle process_id); - if (process) { - result = !!TerminateProcess(process, exit_code); - if (result && wait) { - // The process may not end immediately due to pending I/O - if (WAIT_OBJECT_0 != WaitForSingleObject(process, 60 * 1000)) - DLOG(ERROR) << "Error waiting for process exit: " << GetLastError(); - } else { - DLOG(ERROR) << "Unable to terminate process: " << GetLastError(); - } - CloseHandle(process); + if (process) + return KillProcess(process, exit_code, wait); + return false; +} + +bool KillProcess(HANDLE process, int exit_code, bool wait) { + bool result = !!TerminateProcess(process, exit_code); + if (result && wait) { + // The process may not end immediately due to pending I/O + if (WAIT_OBJECT_0 != WaitForSingleObject(process, 60 * 1000)) + DLOG(ERROR) << "Error waiting for process exit: " << GetLastError(); + } else { + DLOG(ERROR) << "Unable to terminate process: " << GetLastError(); } + CloseHandle(process); return result; } |