diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 20:23:06 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 20:23:06 +0000 |
commit | 1e7377df1449c4e543a50c8a8a1425599c8425f7 (patch) | |
tree | 6e8ee3adcba66e4a043e91e91e0217467682a7fd /chrome/renderer | |
parent | 34cf340da15aceffd59c3d05e0de2a3bc5174a2d (diff) | |
download | chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.zip chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.tar.gz chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.tar.bz2 |
Respect Linux user prefs with regards to crash reporting.
This involves implementing GoogleUpdateSettings::[GS]etCollectStatsConsent, and a whole lot of refactoring.
BUG=none
TEST=delete config dir, run official Linux build, don't enable crash reporting, crash browser -> no crash reporting.
Review URL: http://codereview.chromium.org/115808
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_crash_handler_linux.cc | 85 | ||||
-rw-r--r-- | chrome/renderer/render_crash_handler_linux.h | 16 | ||||
-rw-r--r-- | chrome/renderer/render_crash_handler_linux_stub.cc | 9 | ||||
-rw-r--r-- | chrome/renderer/renderer_main.cc | 7 |
4 files changed, 0 insertions, 117 deletions
diff --git a/chrome/renderer/render_crash_handler_linux.cc b/chrome/renderer/render_crash_handler_linux.cc deleted file mode 100644 index 0594f17..0000000 --- a/chrome/renderer/render_crash_handler_linux.cc +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <string> - -#include <unistd.h> -#include <sys/socket.h> -#include <sys/uio.h> - -#include "base/eintr_wrapper.h" -#include "breakpad/linux/exception_handler.h" -#include "breakpad/linux/linux_libc_support.h" -#include "breakpad/linux/linux_syscall_support.h" - -// This is defined in chrome/renderer/renderer_logging_linux.cc, it's the -// static string containing the current active URL. We send this in the crash -// report. -namespace renderer_logging { -extern std::string active_url; -} - -static bool -CrashHandler(const void* crash_context, size_t crash_context_size, - void* context) { - const int fd = (int) context; - int fds[2]; - pipe(fds); - - // The length of the control message: - static const unsigned kControlMsgSize = - CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(struct ucred)); - - union { - struct kernel_msghdr msg; - struct msghdr sys_msg; - }; - my_memset(&msg, 0, sizeof(struct kernel_msghdr)); - struct kernel_iovec iov[2]; - iov[0].iov_base = const_cast<void*>(crash_context); - iov[0].iov_len = crash_context_size; - iov[1].iov_base = const_cast<char*>(renderer_logging::active_url.data()); - iov[1].iov_len = renderer_logging::active_url.size(); - - msg.msg_iov = iov; - msg.msg_iovlen = 2; - char cmsg[kControlMsgSize]; - memset(cmsg, 0, kControlMsgSize); - msg.msg_control = cmsg; - msg.msg_controllen = sizeof(cmsg); - - struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); - hdr->cmsg_level = SOL_SOCKET; - hdr->cmsg_type = SCM_RIGHTS; - hdr->cmsg_len = CMSG_LEN(sizeof(int)); - *((int*) CMSG_DATA(hdr)) = fds[1]; - hdr = CMSG_NXTHDR(&sys_msg, hdr); - hdr->cmsg_level = SOL_SOCKET; - hdr->cmsg_type = SCM_CREDENTIALS; - hdr->cmsg_len = CMSG_LEN(sizeof(struct ucred)); - struct ucred *cred = reinterpret_cast<struct ucred*>(CMSG_DATA(hdr)); - cred->uid = getuid(); - cred->gid = getgid(); - cred->pid = getpid(); - - HANDLE_EINTR(sys_sendmsg(fd, &msg, 0)); - sys_close(fds[1]); - - char b; - HANDLE_EINTR(sys_read(fds[0], &b, 1)); - - return true; -} - -void EnableRendererCrashDumping() { - // When the browser forks off our process, it installs the crash signal file - // descriptor in this slot: - static const int kMagicCrashSignalFd = 4; - - // We deliberately leak this object. - google_breakpad::ExceptionHandler* handler = - new google_breakpad::ExceptionHandler("" /* unused */, NULL, NULL, - (void*) kMagicCrashSignalFd, true); - handler->set_crash_handler(CrashHandler); -} diff --git a/chrome/renderer/render_crash_handler_linux.h b/chrome/renderer/render_crash_handler_linux.h deleted file mode 100644 index 7a3fa85..0000000 --- a/chrome/renderer/render_crash_handler_linux.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_RENDERER_CRASH_HANDLER_LINUX_H_ -#define CHROME_RENDERER_CRASH_HANDLER_LINUX_H_ - -#include "build/build_config.h" - -#if defined(OS_LINUX) - -extern void EnableRendererCrashDumping(); - -#endif // OS_LINUX - -#endif // CHROME_RENDERER_CRASH_HANDLER_LINUX_H_ diff --git a/chrome/renderer/render_crash_handler_linux_stub.cc b/chrome/renderer/render_crash_handler_linux_stub.cc deleted file mode 100644 index 2da4635..0000000 --- a/chrome/renderer/render_crash_handler_linux_stub.cc +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is a stub file which is compiled in when we are building without -// breakpad support. - -void EnableRendererCrashDumping() { -} diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index 97d633c..fc4d291 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -21,9 +21,6 @@ #include "chrome/common/logging_chrome.h" #include "chrome/common/main_function_params.h" #include "chrome/renderer/renderer_main_platform_delegate.h" -#if defined(OS_LINUX) -#include "chrome/renderer/render_crash_handler_linux.h" -#endif #include "chrome/renderer/render_process.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -73,10 +70,6 @@ int RendererMain(const MainFunctionParams& parameters) { // whatever occurs before it. HandleRendererErrorTestParameters(parsed_command_line); -#if defined(OS_LINUX) - EnableRendererCrashDumping(); -#endif - RendererMainPlatformDelegate platform(parameters); StatsScope<StatsCounterTimer> |