summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:23:06 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 20:23:06 +0000
commit1e7377df1449c4e543a50c8a8a1425599c8425f7 (patch)
tree6e8ee3adcba66e4a043e91e91e0217467682a7fd /chrome
parent34cf340da15aceffd59c3d05e0de2a3bc5174a2d (diff)
downloadchromium_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')
-rw-r--r--chrome/app/breakpad_linux.cc97
-rw-r--r--chrome/app/breakpad_linux.h2
-rw-r--r--chrome/app/breakpad_linux_stub.cc2
-rw-r--r--chrome/app/chrome_dll_main.cc9
-rw-r--r--chrome/browser/browser_main.cc33
-rw-r--r--chrome/browser/first_run_gtk.cc16
-rw-r--r--chrome/browser/google_update_settings_linux.cc41
-rw-r--r--chrome/browser/google_update_settings_linux_unittest.cc23
-rw-r--r--chrome/chrome.gyp22
-rw-r--r--chrome/common/temp_scaffolding_stubs.h36
-rw-r--r--chrome/renderer/render_crash_handler_linux.cc85
-rw-r--r--chrome/renderer/render_crash_handler_linux.h16
-rw-r--r--chrome/renderer/render_crash_handler_linux_stub.cc9
-rw-r--r--chrome/renderer/renderer_main.cc7
14 files changed, 196 insertions, 202 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index ca1e91e..237ed98 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -2,19 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/uio.h>
+#include <unistd.h>
+#include <string>
+
+#include "base/command_line.h"
#include "base/eintr_wrapper.h"
-#include "base/rand_util.h"
#include "base/file_version_info_linux.h"
+#include "base/path_service.h"
+#include "base/rand_util.h"
#include "breakpad/linux/directory_reader.h"
#include "breakpad/linux/exception_handler.h"
#include "breakpad/linux/linux_libc_support.h"
#include "breakpad/linux/linux_syscall_support.h"
#include "breakpad/linux/memory.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/installer/util/google_update_settings.h"
static const char kUploadURL[] =
"https://clients2.google.com/cr/report";
@@ -349,7 +355,7 @@ pid_t UploadCrashDump(const char* filename, const char* crash_url,
};
execv("/usr/bin/wget", const_cast<char**>(args));
- static const char msg[] = "Cannot update crash dump: cannot exec "
+ static const char msg[] = "Cannot upload crash dump: cannot exec "
"/usr/bin/wget\n";
sys_write(2, msg, sizeof(msg) - 1);
sys__exit(1);
@@ -390,3 +396,88 @@ void EnableCrashDumping() {
new google_breakpad::ExceptionHandler("/tmp", NULL, CrashDone, NULL,
true /* install handlers */);
}
+
+// 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
+RendererCrashHandler(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(RendererCrashHandler);
+}
+
+void InitCrashReporter() {
+ if (!GoogleUpdateSettings::GetCollectStatsConsent())
+ return;
+
+ // Determine the process type and take appropriate action.
+ const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+ const std::wstring process_type =
+ parsed_command_line.GetSwitchValue(switches::kProcessType);
+ if (process_type.empty())
+ EnableCrashDumping();
+ else if (process_type == switches::kRendererProcess)
+ EnableRendererCrashDumping();
+}
diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h
index 49a778d..4df9b5e 100644
--- a/chrome/app/breakpad_linux.h
+++ b/chrome/app/breakpad_linux.h
@@ -5,7 +5,7 @@
#ifndef CHROME_APP_BREAKPAD_LINUX_H_
#define CHROME_APP_BREAKPAD_LINUX_H_
-extern void EnableCrashDumping();
+extern void InitCrashReporter();
extern int UploadCrashDump(const char* filename, const char* crash_url,
unsigned crash_url_length);
diff --git a/chrome/app/breakpad_linux_stub.cc b/chrome/app/breakpad_linux_stub.cc
index ee99606..05c0166 100644
--- a/chrome/app/breakpad_linux_stub.cc
+++ b/chrome/app/breakpad_linux_stub.cc
@@ -5,5 +5,5 @@
// This is a stub file which is compiled in when we are building without
// breakpad support.
-void EnableCrashDumping() {
+void InitCrashReporter() {
}
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 69487b6..006d923 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -47,6 +47,8 @@
#endif
#if defined(OS_MACOSX)
#include "chrome/app/breakpad_mac.h"
+#elif defined(OS_LINUX)
+#include "chrome/app/breakpad_linux.h"
#endif
#include "chrome/app/scoped_ole_initializer.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -302,7 +304,7 @@ int ChromeMain(int argc, const char** argv) {
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
#if defined(OS_WIN)
- // Must do this before any other usage of command line!
+ // Must do this before any other usage of command line!
if (HasDeprecatedArguments(parsed_command_line.command_line_string()))
return 1;
#endif
@@ -392,6 +394,11 @@ int ChromeMain(int argc, const char** argv) {
if (!user_data_dir.empty())
CHECK(PathService::Override(chrome::DIR_USER_DATA, user_data_dir));
+#if defined(OS_LINUX)
+ // Needs to be called after we have chrome::DIR_USER_DATA.
+ InitCrashReporter();
+#endif
+
#if defined(OS_POSIX)
// Bug 11776: we mistakenly created directories world-readable.
// Fix old instances of these directories manually.
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 5b955eb..dd0e825 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -4,11 +4,6 @@
#include "build/build_config.h"
-#if defined(OS_WIN)
-#include <windows.h>
-#include <commctrl.h>
-#endif
-
#include <algorithm>
#include "app/l10n_util.h"
@@ -51,6 +46,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/result_codes.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/net_resources.h"
@@ -77,6 +73,7 @@
#if defined(OS_WIN)
#include <windows.h>
+#include <commctrl.h>
#include <shellapi.h>
#include "app/win_util.h"
@@ -111,10 +108,6 @@
#include "chrome/common/gtk_util.h"
#endif
-#if defined(OS_WIN) || defined(OS_MACOSX)
-#include "chrome/installer/util/google_update_settings.h"
-#endif // OS_WIN || OS_MACOSX
-
namespace Platform {
void WillInitializeMainMessageLoop(const CommandLine & command_line);
@@ -252,10 +245,6 @@ int BrowserMain(const MainFunctionParams& parameters) {
CHECK(sigaction(SIGCHLD, &action, NULL) == 0);
#endif
-#if defined(OS_LINUX)
- EnableCrashDumping();
-#endif
-
// Do platform-specific things (such as finishing initializing Cocoa)
// prior to instantiating the message loop. This could be turned into a
// broadcast notification.
@@ -340,10 +329,10 @@ int BrowserMain(const MainFunctionParams& parameters) {
local_state->RegisterStringPref(prefs::kApplicationLocale, L"");
local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, false);
-#if defined(OS_MACOSX)
- // On Mac OS X we display the first run dialog as early as possible, so we can
- // get the stats enabled.
- // TODO:
+#if defined(OS_POSIX)
+ // On Mac OS X / Linux we display the first run dialog as early as possible,
+ // so we can get the stats enabled.
+ // TODO(port):
// We check the kNoFirstRun command line switch explicitly here since the
// early placement of this block happens before that's factored into
// first_run_ui_bypass, we probably want to move that block up
@@ -355,7 +344,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
Profile* profile = NULL;
OpenFirstRunDialog(profile, &process_singleton);
}
-#endif // OS_MACOSX
+#endif // OS_POSIX
// During first run we read the google_update registry key to find what
// language the user selected when downloading the installer. This
@@ -547,12 +536,12 @@ int BrowserMain(const MainFunctionParams& parameters) {
gtk_util::InitRCStyles();
#endif
- // TODO: This block of code should probably be used on all platforms!
- // On Mac OS X we display this dialog before setting the value of
+ // TODO(port): This block of code should probably be used on all platforms!
+ // On Mac OS X / Linux we display this dialog before setting the value of
// kMetricsReportingEnabled, so we display this dialog much earlier.
// On Windows a download is tagged with stats enabled/disabled so the UI
// can be displayed later in the startup process.
-#if !defined(OS_MACOSX)
+#if !defined(OS_POSIX)
// Show the First Run UI if this is the first time Chrome has been run on
// this computer, or we're being compelled to do so by a command line flag.
// Note that this be done _after_ the PrefService is initialized and all
@@ -561,7 +550,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
if (is_first_run && !first_run_ui_bypass) {
OpenFirstRunDialog(profile, &process_singleton);
}
-#endif // OS_MACOSX
+#endif // OS_POSIX
// Sets things up so that if we crash from this point on, a dialog will
// popup asking the user to restart chrome. It is done this late to avoid
diff --git a/chrome/browser/first_run_gtk.cc b/chrome/browser/first_run_gtk.cc
index 8543780..5447a3f 100644
--- a/chrome/browser/first_run_gtk.cc
+++ b/chrome/browser/first_run_gtk.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/first_run.h"
+#include "chrome/app/breakpad_linux.h"
// We need to reach through the browser process to tweak the metrics flag.
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "base/message_loop.h"
@@ -94,11 +96,15 @@ void OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton) {
MessageLoop::current()->Run();
// End of above TODO.
- if (response == GTK_RESPONSE_ACCEPT &&
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check))) {
- // They opted in.
- g_browser_process->local_state()->SetBoolean(
- prefs::kMetricsReportingEnabled, true);
+ if (response == GTK_RESPONSE_ACCEPT) {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check))) {
+ // They opted in.
+ if (GoogleUpdateSettings::SetCollectStatsConsent(true)) {
+ InitCrashReporter();
+ }
+ } else {
+ GoogleUpdateSettings::SetCollectStatsConsent(false);
+ }
}
gtk_widget_destroy(dialog);
diff --git a/chrome/browser/google_update_settings_linux.cc b/chrome/browser/google_update_settings_linux.cc
new file mode 100644
index 0000000..f7ae4b5
--- /dev/null
+++ b/chrome/browser/google_update_settings_linux.cc
@@ -0,0 +1,41 @@
+// 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.
+
+#include "chrome/installer/util/google_update_settings.h"
+
+#include "base/file_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "chrome/common/chrome_paths.h"
+
+// File name used in the user data dir to indicate consent.
+static const char kConsentToSendStats[] = "Consent To Send Stats";
+
+// static
+bool GoogleUpdateSettings::GetCollectStatsConsent() {
+ FilePath consent_file;
+ PathService::Get(chrome::DIR_USER_DATA, &consent_file);
+ consent_file = consent_file.Append(kConsentToSendStats);
+ return file_util::PathExists(consent_file);
+}
+
+// static
+bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
+ FilePath consent_dir;
+ PathService::Get(chrome::DIR_USER_DATA, &consent_dir);
+ if (!file_util::DirectoryExists(consent_dir))
+ return false;
+
+ FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats);
+ if (consented)
+ return file_util::WriteFile(consent_file, "", 0) == 0;
+ else
+ return file_util::Delete(consent_file, false);
+}
+
+// static
+bool GoogleUpdateSettings::GetLanguage(std::wstring* language) {
+ NOTIMPLEMENTED();
+ return false;
+}
diff --git a/chrome/browser/google_update_settings_linux_unittest.cc b/chrome/browser/google_update_settings_linux_unittest.cc
new file mode 100644
index 0000000..35f956a
--- /dev/null
+++ b/chrome/browser/google_update_settings_linux_unittest.cc
@@ -0,0 +1,23 @@
+// 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.
+
+#include "chrome/installer/util/google_update_settings.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+class GoogleUpdateTest : public PlatformTest {
+};
+
+TEST_F(GoogleUpdateTest, StatsConstent) {
+ // Stats are off by default.
+ EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent());
+
+ // Stats reporting is ON.
+ EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true));
+ EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent());
+
+ // Stats reporting is OFF.
+ EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false));
+ EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent());
+}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 42c5b15..daef222 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -870,6 +870,8 @@
'browser/gears_integration.h',
'browser/google_update.cc',
'browser/google_update.h',
+ 'browser/google_update_settings_linux.cc',
+ 'browser/google_update_settings_mac.mm',
'browser/google_url_tracker.cc',
'browser/google_url_tracker.h',
'browser/google_util.cc',
@@ -959,7 +961,6 @@
'browser/gtk/tabs/tab_strip_gtk.h',
'browser/gtk/toolbar_star_toggle_gtk.cc',
'browser/gtk/toolbar_star_toggle_gtk.h',
- 'browser/google_update_settings_mac.mm',
'browser/hang_monitor/hung_plugin_action.cc',
'browser/hang_monitor/hung_plugin_action.h',
'browser/hang_monitor/hung_window_detector.cc',
@@ -1974,18 +1975,6 @@
'dependencies': [
'../build/linux/system.gyp:gtk',
],
- 'conditions': [
- ['linux_breakpad==1', {
- 'sources': [
- 'renderer/render_crash_handler_linux.cc',
- 'renderer/render_crash_handler_linux.h',
- ],
- }, {
- 'sources': [
- 'renderer/render_crash_handler_linux_stub.cc',
- ],
- }]
- ],
}],
# Windows-specific rules.
['OS=="win"', {
@@ -2897,9 +2886,9 @@
],
'sources': [
'app/breakpad_mac_stubs.mm',
- # *NO* files in chrome/app have unit tests (except keystone_glue)!!!
- # It seems a waste to have an app_unittests target, so for now
- # I add keystone_glue.m explicitly to this target.
+ # *NO* files in chrome/app have unit tests (except keystone_glue)!!!
+ # It seems a waste to have an app_unittests target, so for now
+ # I add keystone_glue.m explicitly to this target.
'app/keystone_glue.m',
'app/keystone_glue_unittest.mm',
# All unittests in browser, common, and renderer.
@@ -2975,6 +2964,7 @@
'browser/extensions/user_script_master_unittest.cc',
'browser/find_backend_unittest.cc',
'browser/google_url_tracker_unittest.cc',
+ 'browser/google_update_settings_linux_unittest.cc',
'browser/google_update_settings_mac_unittest.mm',
'browser/gtk/bookmark_editor_gtk_unittest.cc',
'browser/gtk/go_button_gtk_unittest.cc',
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index a9b5ce6..7af52bc 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -51,42 +51,6 @@ class Message;
//---------------------------------------------------------------------------
// These stubs are for Browser_main()
-#if defined(OS_LINUX)
-class GoogleUpdateSettings {
- public:
- static bool GetCollectStatsConsent() {
- NOTIMPLEMENTED();
- return false;
- }
- static bool SetCollectStatsConsent(bool consented) {
- NOTIMPLEMENTED();
- return false;
- }
- static bool GetBrowser(std::wstring* browser) {
- NOTIMPLEMENTED();
- return false;
- }
- static bool GetLanguage(std::wstring* language) {
- NOTIMPLEMENTED();
- return false;
- }
- static bool GetBrand(std::wstring* brand) {
- NOTIMPLEMENTED();
- return false;
- }
- static bool GetReferral(std::wstring* referral) {
- NOTIMPLEMENTED();
- return false;
- }
- static bool ClearReferral() {
- NOTIMPLEMENTED();
- return false;
- }
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings);
-};
-#endif // OS_LINUX
-
void OpenFirstRunDialog(Profile* profile, ProcessSingleton* process_singleton);
void InstallJankometer(const CommandLine&);
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>