summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-22 21:53:43 +0000
committeryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-22 21:53:43 +0000
commit82174aa4938e03fbb38098d2cf283cbf09bfb300 (patch)
tree81702cf79b137684475ee3a25565aaacad3a59ca /chrome/browser
parentca8f905b9e13d9698d5f6c38b805e1c390578c9d (diff)
downloadchromium_src-82174aa4938e03fbb38098d2cf283cbf09bfb300.zip
chromium_src-82174aa4938e03fbb38098d2cf283cbf09bfb300.tar.gz
chromium_src-82174aa4938e03fbb38098d2cf283cbf09bfb300.tar.bz2
Enable breakpad building by default on Android.
After https://chromiumcodereview.appspot.com/10407058 we can compile breakpad by default and still have it disabled for non-official builds. Changes the Android build to allow compiling breakpad but not use it by not creating the crash fd and not passing it to the renderer process unless breakpad is enabled. Changes linux and Android to use a switch for enabling breakpad since that's a lot easier to test with on android then an environment variable. BUG=105778,170530 Review URL: https://chromiumcodereview.appspot.com/11969025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chrome_browser_main_android.cc7
-rw-r--r--chrome/browser/chrome_browser_main_linux.cc15
-rw-r--r--chrome/browser/chrome_content_browser_client.cc16
3 files changed, 23 insertions, 15 deletions
diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc
index 42dd90f..8220fac 100644
--- a/chrome/browser/chrome_browser_main_android.cc
+++ b/chrome/browser/chrome_browser_main_android.cc
@@ -4,10 +4,11 @@
#include "chrome/browser/chrome_browser_main_android.h"
+#include "base/command_line.h"
#include "base/path_service.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/android/crash_dump_manager.h"
-#include "chrome/common/env_vars.h"
+#include "chrome/common/chrome_switches.h"
#include "content/public/browser/android/compositor.h"
#include "content/public/common/main_function_params.h"
#include "net/android/network_change_notifier_factory_android.h"
@@ -33,9 +34,11 @@ void ChromeBrowserMainPartsAndroid::PreProfileInit() {
#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;
+ breakpad_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCrashReporterForTesting);
if (breakpad_enabled) {
InitCrashReporter();
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc
index ac48ad2..ec39b18 100644
--- a/chrome/browser/chrome_browser_main_linux.cc
+++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -14,9 +14,11 @@
#if defined(USE_LINUX_BREAKPAD)
#include <stdlib.h>
+#include "base/command_line.h"
#include "base/linux_util.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
@@ -43,10 +45,10 @@ 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.
- // Environment variables may override the decision, but only if the
+ // Also allow crash reporting to be enabled with a command-line flag 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;
+ bool use_switch = 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
@@ -78,23 +80,24 @@ bool IsCrashReportingEnabled(const PrefService* local_state) {
local_state->FindPreference(prefs::kMetricsReportingEnabled);
CHECK(metrics_reporting_enabled);
breakpad_enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
- use_env_var = metrics_reporting_enabled->IsUserModifiable();
+ use_switch = metrics_reporting_enabled->IsUserModifiable();
#endif // defined(OS_CHROMEOS)
}
- if (use_env_var) {
+ if (use_switch) {
// 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
+ // TODO(mseaborn): Change tests to use --enable-crash-reporter-for-testing
// instead.
if (is_chrome_build && !breakpad_enabled)
breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
if (!breakpad_enabled)
- breakpad_enabled = getenv(env_vars::kEnableBreakpad) != NULL;
+ breakpad_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableCrashReporterForTesting);
}
return breakpad_enabled;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index d27c0b2..4e6c2cb 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1840,13 +1840,15 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
FileDescriptor(f, true)));
#if defined(USE_LINUX_BREAKPAD)
- f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id);
- if (f == base::kInvalidPlatformFileValue) {
- LOG(ERROR) << "Failed to create file for minidump, crash reporting will be "
- "disabled for this process.";
- } else {
- mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor,
- FileDescriptor(f, true)));
+ if (IsCrashReporterEnabled()) {
+ f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id);
+ if (f == base::kInvalidPlatformFileValue) {
+ LOG(ERROR) << "Failed to create file for minidump, crash reporting will "
+ "be disabled for this process.";
+ } else {
+ mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor,
+ FileDescriptor(f, true)));
+ }
}
#endif // defined(USE_LINUX_BREAKPAD)