diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 15:18:00 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 15:18:00 +0000 |
commit | f167520fa923e9b38f6ec86dcbf9150c0c7f2104 (patch) | |
tree | d94a0f5fd2ad3b059d34494838d61a358e7ae971 /content/browser/browser_child_process_host_impl.cc | |
parent | 0d90b384d142e1c62956d817d213a95ae9c38490 (diff) | |
download | chromium_src-f167520fa923e9b38f6ec86dcbf9150c0c7f2104.zip chromium_src-f167520fa923e9b38f6ec86dcbf9150c0c7f2104.tar.gz chromium_src-f167520fa923e9b38f6ec86dcbf9150c0c7f2104.tar.bz2 |
Remove the code to wait on disconnected child processes to get the exit code. This was done in r101435 to fix a problem where we were seeing processes "quit" but the result code wasn't ready. It looks like r68831 caused this, since it made the channel be disconnected before the process exits.
Review URL: https://chromiumcodereview.appspot.com/10702048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_child_process_host_impl.cc')
-rw-r--r-- | content/browser/browser_child_process_host_impl.cc | 75 |
1 files changed, 5 insertions, 70 deletions
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index 0d81c92..00076d9 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc @@ -28,9 +28,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" -#if defined(OS_WIN) -#include "base/synchronization/waitable_event.h" -#elif defined(OS_MACOSX) +#if defined(OS_MACOSX) #include "content/browser/mach_broker_mac.h" #endif @@ -81,11 +79,7 @@ BrowserChildProcessHostImpl::BrowserChildProcessHostImpl( content::ProcessType type, BrowserChildProcessHostDelegate* delegate) : data_(type), - delegate_(delegate), -#if !defined(OS_WIN) - ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), -#endif - disconnect_was_alive_(false) { + delegate_(delegate) { data_.id = ChildProcessHostImpl::GenerateChildProcessUniqueId(); child_process_host_.reset(ChildProcessHost::Create(this)); @@ -211,13 +205,6 @@ bool BrowserChildProcessHostImpl::CanShutdown() { return delegate_->CanShutdown(); } -// Normally a ChildProcessHostDelegate deletes itself from this callback, but at -// this layer and below we need to have the final child process exit code to -// properly bucket crashes vs kills. On Windows we can do this if we wait until -// the process handle is signaled; on the rest of the platforms, we schedule a -// delayed task to wait for an exit code. However, this means that this method -// may be called twice: once from the actual channel error and once from -// OnWaitableEventSignaled() or the delayed task. void BrowserChildProcessHostImpl::OnChildDisconnected() { DCHECK(data_.handle != base::kNullProcessHandle); int exit_code; @@ -231,11 +218,6 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() { UMA_HISTOGRAM_ENUMERATION("ChildProcess.Crashed", data_.type, content::PROCESS_TYPE_MAX); - if (disconnect_was_alive_) { - UMA_HISTOGRAM_ENUMERATION("ChildProcess.CrashedWasAlive", - data_.type, - content::PROCESS_TYPE_MAX); - } break; } case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: { @@ -244,42 +226,13 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() { UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed", data_.type, content::PROCESS_TYPE_MAX); - if (disconnect_was_alive_) { - UMA_HISTOGRAM_ENUMERATION("ChildProcess.KilledWasAlive", - data_.type, - content::PROCESS_TYPE_MAX); - } break; } case base::TERMINATION_STATUS_STILL_RUNNING: { - // Exit code not yet available. Ensure we don't wait forever for an exit - // code. - if (disconnect_was_alive_) { - UMA_HISTOGRAM_ENUMERATION("ChildProcess.DisconnectedAlive", - data_.type, - content::PROCESS_TYPE_MAX); - break; - } - disconnect_was_alive_ = true; -#if defined(OS_WIN) - child_watcher_.StartWatching( - new base::WaitableEvent(data_.handle), this); -#else - // On non-Windows platforms, give the child process some time to die after - // disconnecting the channel so that the exit code and termination status - // become available. This is best effort -- if the process doesn't die - // within the time limit, this object gets destroyed. - const base::TimeDelta kExitCodeWait = - base::TimeDelta::FromMilliseconds(250); - MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::Bind(&BrowserChildProcessHostImpl::OnChildDisconnected, - task_factory_.GetWeakPtr()), - kExitCodeWait); -#endif - return; + UMA_HISTOGRAM_ENUMERATION("ChildProcess.DisconnectedAlive", + data_.type, + content::PROCESS_TYPE_MAX); } - default: break; } @@ -291,24 +244,6 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() { delete delegate_; // Will delete us } -// The child process handle has been signaled so the exit code is finally -// available. Unfortunately STILL_ACTIVE (0x103) is a valid exit code in -// which case we should not call OnChildDisconnected() or else we will be -// waiting forever. -void BrowserChildProcessHostImpl::OnWaitableEventSignaled( - base::WaitableEvent* waitable_event) { -#if defined (OS_WIN) - unsigned long exit_code = 0; - GetExitCodeProcess(waitable_event->Release(), &exit_code); - delete waitable_event; - if (exit_code == STILL_ACTIVE) { - delete delegate_; // Will delete us - } else { - BrowserChildProcessHostImpl::OnChildDisconnected(); - } -#endif -} - bool BrowserChildProcessHostImpl::Send(IPC::Message* message) { return child_process_host_->Send(message); } |