summaryrefslogtreecommitdiffstats
path: root/chrome/browser/child_process_host.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-05 02:41:38 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-05 02:41:38 +0000
commitcd69619bc053d527b7c82aac81c605157b28d01f (patch)
treef5a50afb86bd0ee0e0dae9a23213dcfaf1b9105e /chrome/browser/child_process_host.cc
parent980dbfd913c463f5fa8f1b5943327fe5e4799b20 (diff)
downloadchromium_src-cd69619bc053d527b7c82aac81c605157b28d01f.zip
chromium_src-cd69619bc053d527b7c82aac81c605157b28d01f.tar.gz
chromium_src-cd69619bc053d527b7c82aac81c605157b28d01f.tar.bz2
Revert 46384 - Fix race in zygote_host_linux where socket was being read from and written to on different threads.
Made ZygoteHost methods all run on PROCESS_LAUNCHER thread. PostTask in linux from UI thread to PROCESS_LAUNCHER thread for DidProcessCrash. Changed DidProcessCrash to answer via a callback, which occurs asynchronously on linux. Rework cases in nacl_host, browser_render_process_host, and child_process_host where this method was being called to fit the callback model. BUG=31737 TEST=none Review URL: http://codereview.chromium.org/1695026 TBR=kkania@chromium.org Review URL: http://codereview.chromium.org/1933007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46429 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/child_process_host.cc')
-rw-r--r--chrome/browser/child_process_host.cc38
1 files changed, 10 insertions, 28 deletions
diff --git a/chrome/browser/child_process_host.cc b/chrome/browser/child_process_host.cc
index 2a828e0..0c87021 100644
--- a/chrome/browser/child_process_host.cc
+++ b/chrome/browser/child_process_host.cc
@@ -179,36 +179,23 @@ void ChildProcessHost::Notify(NotificationType type) {
ChromeThread::UI, FROM_HERE, new ChildNotificationTask(type, this));
}
-void ChildProcessHost::DetermineDidChildCrash() {
- child_process_->DetermineDidProcessCrash();
+bool ChildProcessHost::DidChildCrash() {
+ return child_process_->DidProcessCrash();
}
void ChildProcessHost::OnChildDied() {
- // Either of these paths will lead to deleting this object in
- // OnDidProcessCrashDetermined, so they should be the last calls in this
- // method.
- if (handle() != base::kNullProcessHandle) {
- // Determine whether the process crashed or not. This method will invoke
- // OnDidProcessCrashDetermined with the result. This may occur
- // asynchronously.
- DetermineDidChildCrash();
- } else {
- // We do not have a process, so it couldn't have crashed.
- OnDidProcessCrashDetermined(false);
- }
-}
-
-void ChildProcessHost::OnDidProcessCrashDetermined(bool did_crash) {
- if (did_crash) {
- OnProcessCrashed();
- // Report that this child process crashed.
- Notify(NotificationType::CHILD_PROCESS_CRASHED);
- UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type());
- }
if (handle() != base::kNullProcessHandle) {
+ bool did_crash = DidChildCrash();
+ if (did_crash) {
+ OnProcessCrashed();
+ // Report that this child process crashed.
+ Notify(NotificationType::CHILD_PROCESS_CRASHED);
+ UMA_HISTOGRAM_COUNTS("ChildProcess.Crashes", this->type());
+ }
// Notify in the main loop of the disconnection.
Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED);
}
+
delete this;
}
@@ -291,11 +278,6 @@ void ChildProcessHost::ListenerHook::OnProcessLaunched() {
host_->OnProcessLaunched();
}
-void ChildProcessHost::ListenerHook::OnDidProcessCrashDetermined(
- bool did_crash) {
- host_->OnDidProcessCrashDetermined(did_crash);
-}
-
ChildProcessHost::Iterator::Iterator()
: all_(true), type_(UNKNOWN_PROCESS) {