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

Unified Diff: base/process/process_win.cc

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 months 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
Index: base/process/process_win.cc
diff --git a/base/process/process_win.cc b/base/process/process_win.cc
index d72dd49c9d69196861d0e0e89929b339cdf5c0c0..0d312a3599088eabf4bc2043a5f875b6d1f9d019 100644
--- a/base/process/process_win.cc
+++ b/base/process/process_win.cc
@@ -32,6 +32,9 @@ Process::Process(RValue other)
other.object->Close();
}
+Process::~Process() {
+}
+
Process& Process::operator=(RValue other) {
if (this != other.object) {
process_.Set(other.object->process_.Take());
@@ -123,10 +126,17 @@ void Process::Close() {
process_.Close();
}
-bool Process::Terminate(int result_code, bool wait) const {
+bool Process::Terminate(int exit_code, bool wait) const {
DCHECK(IsValid());
- // TODO(rvargas) crbug/417532: Move the implementation here.
- return KillProcess(Handle(), result_code, wait);
+ bool result = (::TerminateProcess(Handle(), exit_code) != FALSE);
+ if (result && wait) {
+ // The process may not end immediately due to pending I/O
+ if (::WaitForSingleObject(Handle(), 60 * 1000) != WAIT_OBJECT_0)
+ DPLOG(ERROR) << "Error waiting for process exit";
+ } else if (!result) {
+ DPLOG(ERROR) << "Unable to terminate process";
+ }
+ return result;
}
bool Process::WaitForExit(int* exit_code) {

Powered by Google App Engine
This is Rietveld 408576698