summaryrefslogtreecommitdiffstats
path: root/chrome/browser/nacl_host
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 20:23:36 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 20:23:36 +0000
commit3131a4bc3ef3b6f545b7dea6ea55d8419099b7b2 (patch)
treefef3b85252836c1afe7c354ba9a6e5766d8402ac /chrome/browser/nacl_host
parentfcc2caa7b147a296f450df1d3bbcd2bc4569093e (diff)
downloadchromium_src-3131a4bc3ef3b6f545b7dea6ea55d8419099b7b2.zip
chromium_src-3131a4bc3ef3b6f545b7dea6ea55d8419099b7b2.tar.gz
chromium_src-3131a4bc3ef3b6f545b7dea6ea55d8419099b7b2.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/nacl_host')
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc17
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.h3
2 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 2648b3e..0310e39 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -117,10 +117,19 @@ void NaClProcessHost::OnProcessLaunchedByBroker(base::ProcessHandle handle) {
OnProcessLaunched();
}
-bool NaClProcessHost::DidChildCrash() {
- if (running_on_wow64_)
- return base::DidProcessCrash(NULL, handle());
- return ChildProcessHost::DidChildCrash();
+void NaClProcessHost::DetermineDidChildCrash() {
+ // Either of these paths will lead to deleting this object in
+ // OnDidProcessCrashDetermined in ChildProcessHost, so they should be the
+ // last calls in this method.
+ if (running_on_wow64_) {
+ bool did_crash = base::DidProcessCrash(NULL, handle());
+ OnDidProcessCrashDetermined(did_crash);
+ } else {
+ // Determine whether the process crashed or not. This method will invoke
+ // OnDidProcessCrashDetermined with the result. This may occur
+ // asynchronously.
+ ChildProcessHost::DetermineDidChildCrash();
+ }
}
void NaClProcessHost::OnChildDied() {
diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h
index 28893fc..b6c3313 100644
--- a/chrome/browser/nacl_host/nacl_process_host.h
+++ b/chrome/browser/nacl_host/nacl_process_host.h
@@ -36,7 +36,8 @@ class NaClProcessHost : public ChildProcessHost {
void OnProcessLaunchedByBroker(base::ProcessHandle handle);
protected:
- virtual bool DidChildCrash();
+ // Override ChildProcessHost methods.
+ virtual void DetermineDidChildCrash();
virtual void OnChildDied();
private: