summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 16:13:10 +0000
committermseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-15 16:13:10 +0000
commitce4367d711020e55c50fe31fc860291f8e3d58b2 (patch)
tree519045961187f0299bf2a018ebca15338b48adff /chrome
parentfe6f8cba8c03773d2a1a432fc464a0c459e6cd40 (diff)
downloadchromium_src-ce4367d711020e55c50fe31fc860291f8e3d58b2.zip
chromium_src-ce4367d711020e55c50fe31fc860291f8e3d58b2.tar.gz
chromium_src-ce4367d711020e55c50fe31fc860291f8e3d58b2.tar.bz2
Compile Breakpad into Chromium by default on Linux
This brings the Linux build into line with the Windows and Mac builds, where Breakpad is compiled in by default. This allows us to test Breakpad on the trybots and buildbots. It's still possible to omit Breakpad support using a Gyp option. As with Windows and Mac, we don't want to enable Breakpad in Chromium at run time by default (since that would spam the crash server, which doesn't have symbols for Chromium builds anyway), so we put this behind a run time flag. We also don't compile in debug info (-g) by default. We extend NaCl's Breakpad tests to be able to locate crash dumps on Linux. We add some "#ifdef GOOGLE_CHROME_BUILD"s to prevent Breakpad from being enabled accidentally without the run time flag, but this is just in case because there should be no GUI option for enabling stats/crash reporting inside non-Chrome Chromium builds. BUG=105778 TEST=breakpad_browser_process_crash_test in nacl_integration Review URL: https://chromiumcodereview.appspot.com/10407058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176911 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_browser_main_android.cc12
-rw-r--r--chrome/browser/chrome_browser_main_linux.cc73
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc2
-rw-r--r--chrome/common/env_vars.cc5
-rw-r--r--chrome/common/env_vars.h1
5 files changed, 69 insertions, 24 deletions
diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc
index 0846570..354a92d 100644
--- a/chrome/browser/chrome_browser_main_android.cc
+++ b/chrome/browser/chrome_browser_main_android.cc
@@ -23,10 +23,20 @@ ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() {
void ChromeBrowserMainPartsAndroid::PreProfileInit() {
#if defined(USE_LINUX_BREAKPAD)
+#if defined(GOOGLE_CHROME_BUILD)
// TODO(jcivelli): we should not initialize the crash-reporter when it was not
// enabled. Right now if it is disabled we still generate the minidumps but we
// do not upload them.
- InitCrashReporter();
+ bool breakpad_enabled = true;
+#else
+ bool breakpad_enabled = false;
+#endif
+ // Allow Breakpad to be enabled in Chromium builds for testing purposes.
+ if (!breakpad_enabled)
+ breakpad_enabled = getenv(env_vars::kEnableBreakpad) != NULL;
+
+ if (breakpad_enabled)
+ InitCrashReporter();
#endif
ChromeBrowserMainParts::PreProfileInit();
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc
index 2bf9e3a..ac48ad2 100644
--- a/chrome/browser/chrome_browser_main_linux.cc
+++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -43,31 +43,60 @@ bool IsCrashReportingEnabled(const PrefService* local_state) {
// Check whether we should initialize the crash reporter. It may be disabled
// through configuration policy or user preference. It must be disabled for
// Guest mode on Chrome OS in Stable channel.
- // The kHeadless environment variable overrides the decision, but only if the
- // crash service is under control of the user. It is used by QA testing
- // infrastructure to switch on generation of crash reports.
+ // Environment variables may override the decision, but only if the
+ // crash service is under control of the user. It is used by QA
+ // testing infrastructure to switch on generation of crash reports.
+ bool use_env_var = true;
+
+ // Convert #define to a variable so that we can use if() rather than
+ // #if below and so at least compile-test the Chrome code in
+ // Chromium builds.
+#if defined(GOOGLE_CHROME_BUILD)
+ bool is_chrome_build = true;
+#else
+ bool is_chrome_build = false;
+#endif
+
+ // Check these settings in Chrome builds only, to reduce the chance
+ // that we accidentally upload crash dumps from Chromium builds.
+ bool breakpad_enabled = false;
+ if (is_chrome_build) {
#if defined(OS_CHROMEOS)
- bool is_guest_session =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
- bool is_stable_channel =
- chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
- // TODO(pastarmovj): Consider the TrustedGet here.
- bool reporting_enabled;
- chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
- &reporting_enabled);
- bool breakpad_enabled =
- !(is_guest_session && is_stable_channel) && reporting_enabled;
- if (!breakpad_enabled)
- breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
+ bool is_guest_session =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
+ bool is_stable_channel =
+ chrome::VersionInfo::GetChannel() ==
+ chrome::VersionInfo::CHANNEL_STABLE;
+ // TODO(pastarmovj): Consider the TrustedGet here.
+ bool reporting_enabled;
+ chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
+ &reporting_enabled);
+ breakpad_enabled =
+ !(is_guest_session && is_stable_channel) && reporting_enabled;
#else
- const PrefService::Preference* metrics_reporting_enabled =
- local_state->FindPreference(prefs::kMetricsReportingEnabled);
- CHECK(metrics_reporting_enabled);
- bool breakpad_enabled =
- local_state->GetBoolean(prefs::kMetricsReportingEnabled);
- if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable())
- breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
+ const PrefService::Preference* metrics_reporting_enabled =
+ local_state->FindPreference(prefs::kMetricsReportingEnabled);
+ CHECK(metrics_reporting_enabled);
+ breakpad_enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
+ use_env_var = metrics_reporting_enabled->IsUserModifiable();
#endif // defined(OS_CHROMEOS)
+ }
+
+ if (use_env_var) {
+ // Linux Breakpad interferes with the debug stack traces produced
+ // by EnableInProcessStackDumping(), used in browser_tests, so we
+ // do not allow CHROME_HEADLESS=1 to enable Breakpad in Chromium
+ // because the buildbots have CHROME_HEADLESS set. However, we
+ // allow CHROME_HEADLESS to enable Breakpad in Chrome for
+ // compatibility with Breakpad/Chrome tests that may rely on this.
+ // TODO(mseaborn): Change tests to use CHROME_ENABLE_BREAKPAD
+ // instead.
+ if (is_chrome_build && !breakpad_enabled)
+ breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
+ if (!breakpad_enabled)
+ breakpad_enabled = getenv(env_vars::kEnableBreakpad) != NULL;
+ }
+
return breakpad_enabled;
}
#endif // defined(USE_LINUX_BREAKPAD)
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index a14b262..cfc4c16 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -454,7 +454,7 @@ void WizardController::OnEulaAccepted() {
CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled);
if (uma_enabled) {
-#if defined(USE_LINUX_BREAKPAD)
+#if defined(USE_LINUX_BREAKPAD) && defined(GOOGLE_CHROME_BUILD)
// The crash reporter initialization needs IO to complete.
base::ThreadRestrictions::ScopedAllowIO allow_io;
InitCrashReporter();
diff --git a/chrome/common/env_vars.cc b/chrome/common/env_vars.cc
index 06e10f8..c678126 100644
--- a/chrome/common/env_vars.cc
+++ b/chrome/common/env_vars.cc
@@ -6,6 +6,11 @@
namespace env_vars {
+// Enable Breakpad crash reporting. This is used for automated
+// testing of Breakpad in Chromium builds where Breakpad is compiled
+// in by default but not usually enabled.
+const char kEnableBreakpad[] = "CHROME_ENABLE_BREAKPAD";
+
// We call running in unattended mode (for automated testing) "headless".
// This mode can be enabled using this variable or by the kNoErrorDialogs
// switch.
diff --git a/chrome/common/env_vars.h b/chrome/common/env_vars.h
index 0b3ba6f..19ea5b0 100644
--- a/chrome/common/env_vars.h
+++ b/chrome/common/env_vars.h
@@ -9,6 +9,7 @@
namespace env_vars {
+extern const char kEnableBreakpad[];
extern const char kHeadless[];
extern const char kLogFileName[];
extern const char kSessionLogDir[];