summaryrefslogtreecommitdiffstats
path: root/content/browser/child_process_launcher.cc
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 22:03:38 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-24 22:03:38 +0000
commit40da3e0c42d83eb6225d9d340780bd6e3af14b6c (patch)
treeabb3a7d5bc2db5dcdbd5031fa6acbf018e9a0652 /content/browser/child_process_launcher.cc
parent4d8517ad228e3eb26bcc776c6c95dcdfeb51a31c (diff)
downloadchromium_src-40da3e0c42d83eb6225d9d340780bd6e3af14b6c.zip
chromium_src-40da3e0c42d83eb6225d9d340780bd6e3af14b6c.tar.gz
chromium_src-40da3e0c42d83eb6225d9d340780bd6e3af14b6c.tar.bz2
Because of UID isolation on Android, crash dump generation has to happen
in-process for renderers as well (as the browser cannot access all the necessary states of the renderer process). Breakpad has support for generating minidumps to a passed FD (as the renderer process on Android does not have permission to create file), so the flow on Android is: - when a render process is created the browser creates a file and passes its FD to the process - the renderer process initializes Breakpad with that FD - if there is a crash, Breakpad generates the minidump to that FD. - when the browser process detects a renderer stopped it checks the minidump file. If it's empty it deletes the file. If it's not empty, it means there was a crasher in which case it moves it to the crash dump folder for it to be picked up and uploaded by the Java side. BUG=None TEST=Test that minidumps are generated and uploaded when visiting about:crash and about:crashbrowserforrealz on Android and desktop Chrome. Review URL: https://chromiumcodereview.appspot.com/11189068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163917 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/child_process_launcher.cc')
-rw-r--r--content/browser/child_process_launcher.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 82a0f2b..d0f0570 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -76,6 +76,7 @@ class ChildProcessLauncher::Context
int ipcfd,
#endif
CommandLine* cmd_line,
+ int child_process_id,
Client* client) {
client_ = client;
@@ -93,6 +94,7 @@ class ChildProcessLauncher::Context
&Context::LaunchInternal,
make_scoped_refptr(this),
client_thread_id_,
+ child_process_id,
#if defined(OS_WIN)
exposed_dir,
#elif defined(OS_ANDROID)
@@ -149,6 +151,7 @@ class ChildProcessLauncher::Context
// |this_object| is NOT thread safe. Only use it to post a task back.
scoped_refptr<Context> this_object,
BrowserThread::ID client_thread_id,
+ int child_process_id,
#if defined(OS_WIN)
const FilePath& exposed_dir,
#elif defined(OS_ANDROID)
@@ -173,7 +176,8 @@ class ChildProcessLauncher::Context
base::FileDescriptor(ipcfd, false)));
GetContentClient()->browser()->
- GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register);
+ GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
+ &files_to_register);
StartSandboxedProcess(cmd_line->argv(), files_to_register,
base::Bind(&ChildProcessLauncher::Context::OnSandboxedProcessStarted,
@@ -194,7 +198,8 @@ class ChildProcessLauncher::Context
#if !defined(OS_MACOSX)
GetContentClient()->browser()->
- GetAdditionalMappedFilesForChildProcess(*cmd_line, &files_to_register);
+ GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id,
+ &files_to_register);
if (use_zygote) {
handle = ZygoteHostImpl::GetInstance()->ForkRequest(cmd_line->argv(),
files_to_register,
@@ -205,12 +210,11 @@ class ChildProcessLauncher::Context
{
// Convert FD mapping to FileHandleMappingVector
base::FileHandleMappingVector fds_to_map;
- for (std::vector<FileDescriptorInfo>::const_iterator
- i = files_to_register.begin(); i != files_to_register.end(); ++i) {
- const FileDescriptorInfo& fd_info = *i;
+ for (size_t i = 0; i < files_to_register.size(); ++i) {
fds_to_map.push_back(std::make_pair(
- fd_info.fd.fd,
- fd_info.id + base::GlobalDescriptors::kBaseDescriptor));
+ files_to_register[i].fd.fd,
+ files_to_register[i].id +
+ base::GlobalDescriptors::kBaseDescriptor));
}
#if !defined(OS_MACOSX)
@@ -379,6 +383,7 @@ ChildProcessLauncher::ChildProcessLauncher(
int ipcfd,
#endif
CommandLine* cmd_line,
+ int child_process_id,
Client* client) {
context_ = new Context();
context_->Launch(
@@ -392,6 +397,7 @@ ChildProcessLauncher::ChildProcessLauncher(
ipcfd,
#endif
cmd_line,
+ child_process_id,
client);
}