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

Side by Side Diff: base/process/process_win.cc

Issue 2629623003: Win should call ::TerminateProcess to exit a renderer process (Closed)
Patch Set: temp Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include "base/debug/activity_tracker.h" 7 #include "base/debug/activity_tracker.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/process/kill.h" 10 #include "base/process/kill.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (result && wait) { 130 if (result && wait) {
131 // The process may not end immediately due to pending I/O 131 // The process may not end immediately due to pending I/O
132 if (::WaitForSingleObject(Handle(), 60 * 1000) != WAIT_OBJECT_0) 132 if (::WaitForSingleObject(Handle(), 60 * 1000) != WAIT_OBJECT_0)
133 DPLOG(ERROR) << "Error waiting for process exit"; 133 DPLOG(ERROR) << "Error waiting for process exit";
134 } else if (!result) { 134 } else if (!result) {
135 DPLOG(ERROR) << "Unable to terminate process"; 135 DPLOG(ERROR) << "Unable to terminate process";
136 } 136 }
137 return result; 137 return result;
138 } 138 }
139 139
140 void Process::TerminateCurrentProcessImmediately(int exit_code) const {
141 ::TerminateProcess(Handle(), exit_code);
142 }
143
140 bool Process::WaitForExit(int* exit_code) const { 144 bool Process::WaitForExit(int* exit_code) const {
141 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(INFINITE), 145 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(INFINITE),
142 exit_code); 146 exit_code);
143 } 147 }
144 148
145 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { 149 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const {
146 // Record the event that this thread is blocking upon (for hang diagnosis). 150 // Record the event that this thread is blocking upon (for hang diagnosis).
147 base::debug::ScopedProcessWaitActivity process_activity(this); 151 base::debug::ScopedProcessWaitActivity process_activity(this);
148 152
149 // Limit timeout to INFINITE. 153 // Limit timeout to INFINITE.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 188
185 return (::SetPriorityClass(Handle(), priority) != 0); 189 return (::SetPriorityClass(Handle(), priority) != 0);
186 } 190 }
187 191
188 int Process::GetPriority() const { 192 int Process::GetPriority() const {
189 DCHECK(IsValid()); 193 DCHECK(IsValid());
190 return ::GetPriorityClass(Handle()); 194 return ::GetPriorityClass(Handle());
191 } 195 }
192 196
193 } // namespace base 197 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698