summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 00:11:36 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 00:11:36 +0000
commitdc86a86d5266c4f87c56aa0db4ed41a6c352dc90 (patch)
tree3dd2720120bca8060daee2e51f2fa0f528a58294 /chrome
parentca611d2e4a1b784c5f362e93f177dba9bc8108f8 (diff)
downloadchromium_src-dc86a86d5266c4f87c56aa0db4ed41a6c352dc90.zip
chromium_src-dc86a86d5266c4f87c56aa0db4ed41a6c352dc90.tar.gz
chromium_src-dc86a86d5266c4f87c56aa0db4ed41a6c352dc90.tar.bz2
Use base::KillProcess to terminate watched process in process_proxy.
TEST=ProcessProxyTest.* BUG=None Review URL: http://codereview.chromium.org/8994017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/process_proxy/process_proxy.cc9
-rw-r--r--chrome/browser/chromeos/process_proxy/process_proxy_browsertest.cc8
2 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/process_proxy/process_proxy.cc b/chrome/browser/chromeos/process_proxy/process_proxy.cc
index 9696519..e809cd2 100644
--- a/chrome/browser/chromeos/process_proxy/process_proxy.cc
+++ b/chrome/browser/chromeos/process_proxy/process_proxy.cc
@@ -130,14 +130,13 @@ void ProcessProxy::Close() {
process_launched_ = false;
callback_set_ = false;
+ // Wait to ensure process dies before we call StopWatching and close read
+ // end of the pipe the process writes to.
+ base::KillProcess(pid_, 0, true /* wait */);
+
// TODO(tbarzic): What if this fails?
StopWatching();
- if (HANDLE_EINTR(kill(pid_, SIGQUIT)) != 0)
- DPLOG(WARNING) << "sigquit failed.";
-
- base::EnsureProcessGetsReaped(pid_);
-
// Close all fds owned by us that may still be opened. If wather had been
// started, it took ownership of some fds.
if (!watcher_started_) {
diff --git a/chrome/browser/chromeos/process_proxy/process_proxy_browsertest.cc b/chrome/browser/chromeos/process_proxy/process_proxy_browsertest.cc
index 0a17b41..f6ce389 100644
--- a/chrome/browser/chromeos/process_proxy/process_proxy_browsertest.cc
+++ b/chrome/browser/chromeos/process_proxy/process_proxy_browsertest.cc
@@ -79,9 +79,11 @@ class ProcessProxyTest : public InProcessBrowserTest {
void EndRegistryTest() {
registry_->CloseProcess(pid_);
- // Make sure process gets reaped.
- // TODO(tbarzic): Revisit this.
- EXPECT_NE(0, HANDLE_EINTR(waitpid(pid_,NULL, 0)));
+ base::TerminationStatus status = base::GetTerminationStatus(pid_, NULL);
+ EXPECT_NE(base::TERMINATION_STATUS_STILL_RUNNING, status);
+
+ if (status == base::TERMINATION_STATUS_STILL_RUNNING)
+ base::KillProcess(pid_, 0, true);
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
MessageLoop::QuitClosure());