summaryrefslogtreecommitdiffstats
path: root/chrome/browser/zygote_host_linux.h
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/zygote_host_linux.h
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/zygote_host_linux.h')
-rw-r--r--chrome/browser/zygote_host_linux.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/zygote_host_linux.h b/chrome/browser/zygote_host_linux.h
index 53485e0..21118d5 100644
--- a/chrome/browser/zygote_host_linux.h
+++ b/chrome/browser/zygote_host_linux.h
@@ -26,15 +26,19 @@ class ZygoteHost {
public:
void Init(const std::string& sandbox_cmd);
- // Tries to start a renderer process. Returns its pid on success, otherwise
- // base::kNullProcessHandle;
+ // Tries to start a renderer process. Returns its pid on success, otherwise
+ // base::kNullProcessHandle. Must be called on the PROCESS_LAUNCHER
+ // thread.
pid_t ForkRenderer(const std::vector<std::string>& command_line,
const base::GlobalDescriptors::Mapping& mapping);
+
+ // Must be called on the PROCESS_LAUNCHER thread.
void EnsureProcessTerminated(pid_t process);
// Get the termination status (exit code) of the process and return true if
// the status indicates the process crashed. |child_exited| is set to true
// iff the child process has terminated. (|child_exited| may be NULL.)
+ // Must be called on the PROCESS_LAUNCHER thread.
bool DidProcessCrash(base::ProcessHandle handle, bool* child_exited);
// These are the command codes used on the wire between the browser and the
@@ -52,7 +56,10 @@ class ZygoteHost {
ZygoteHost();
~ZygoteHost();
- int control_fd_; // the socket to the zygote
+ // The socket to the zygote, which should only be accessed on the
+ // PROCESS_LAUNCHER thread.
+ int control_fd_;
+
pid_t pid_;
bool init_;
bool using_suid_sandbox_;