Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/chrome_browser_main_linux.cc

Issue 10407058: Compile in Breakpad by default on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add #ifdef to chrome/browser/chromeos/login/wizard_controller.cc too Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main_linux.h" 5 #include "chrome/browser/chrome_browser_main_linux.h"
6 6
7 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_ linux.h" 7 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_ linux.h"
8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" 8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
9 9
10 #if !defined(OS_CHROMEOS) 10 #if !defined(OS_CHROMEOS)
(...skipping 25 matching lines...) Expand all
36 #if !defined(OS_CHROMEOS) 36 #if !defined(OS_CHROMEOS)
37 void GetLinuxDistroCallback() { 37 void GetLinuxDistroCallback() {
38 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. 38 base::GetLinuxDistro(); // Initialize base::linux_distro if needed.
39 } 39 }
40 #endif 40 #endif
41 41
42 bool IsCrashReportingEnabled(const PrefService* local_state) { 42 bool IsCrashReportingEnabled(const PrefService* local_state) {
43 // Check whether we should initialize the crash reporter. It may be disabled 43 // Check whether we should initialize the crash reporter. It may be disabled
44 // through configuration policy or user preference. It must be disabled for 44 // through configuration policy or user preference. It must be disabled for
45 // Guest mode on Chrome OS in Stable channel. 45 // Guest mode on Chrome OS in Stable channel.
46 // The kHeadless environment variable overrides the decision, but only if the 46 // Environment variables may override the decision, but only if the
47 // crash service is under control of the user. It is used by QA testing 47 // crash service is under control of the user. It is used by QA
48 // infrastructure to switch on generation of crash reports. 48 // testing infrastructure to switch on generation of crash reports.
49 bool use_env_var = true;
50
51 // Convert #define to a variable so that we can use if() rather than
52 // #if below and so at least compile-test the Chrome code in
53 // Chromium builds.
54 #if defined(GOOGLE_CHROME_BUILD)
55 bool is_chrome_build = true;
56 #else
57 bool is_chrome_build = false;
58 #endif
59
60 // Check these settings in Chrome builds only, to reduce the chance
61 // that we accidentally upload crash dumps from Chromium builds.
62 bool breakpad_enabled = false;
63 if (is_chrome_build) {
49 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
50 bool is_guest_session = 65 bool is_guest_session =
51 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); 66 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession);
52 bool is_stable_channel = 67 bool is_stable_channel =
53 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; 68 chrome::VersionInfo::GetChannel() ==
54 // TODO(pastarmovj): Consider the TrustedGet here. 69 chrome::VersionInfo::CHANNEL_STABLE;
55 bool reporting_enabled; 70 // TODO(pastarmovj): Consider the TrustedGet here.
56 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, 71 bool reporting_enabled;
57 &reporting_enabled); 72 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
58 bool breakpad_enabled = 73 &reporting_enabled);
59 !(is_guest_session && is_stable_channel) && reporting_enabled; 74 breakpad_enabled =
60 if (!breakpad_enabled) 75 !(is_guest_session && is_stable_channel) && reporting_enabled;
61 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
62 #else 76 #else
63 const PrefService::Preference* metrics_reporting_enabled = 77 const PrefService::Preference* metrics_reporting_enabled =
64 local_state->FindPreference(prefs::kMetricsReportingEnabled); 78 local_state->FindPreference(prefs::kMetricsReportingEnabled);
65 CHECK(metrics_reporting_enabled); 79 CHECK(metrics_reporting_enabled);
66 bool breakpad_enabled = 80 breakpad_enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
67 local_state->GetBoolean(prefs::kMetricsReportingEnabled); 81 use_env_var = metrics_reporting_enabled->IsUserModifiable();
68 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable())
69 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
70 #endif // defined(OS_CHROMEOS) 82 #endif // defined(OS_CHROMEOS)
83 }
84
85 if (use_env_var) {
86 // Linux Breakpad interferes with the debug stack traces produced
87 // by EnableInProcessStackDumping(), used in browser_tests, so we
88 // do not allow CHROME_HEADLESS=1 to enable Breakpad in Chromium
89 // because the buildbots have CHROME_HEADLESS set. However, we
90 // allow CHROME_HEADLESS to enable Breakpad in Chrome for
91 // compatibility with Breakpad/Chrome tests that may rely on this.
92 // TODO(mseaborn): Change tests to use CHROME_ENABLE_BREAKPAD
93 // instead.
94 if (is_chrome_build && !breakpad_enabled)
95 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
96 if (!breakpad_enabled)
97 breakpad_enabled = getenv(env_vars::kEnableBreakpad) != NULL;
98 }
99
71 return breakpad_enabled; 100 return breakpad_enabled;
72 } 101 }
73 #endif // defined(USE_LINUX_BREAKPAD) 102 #endif // defined(USE_LINUX_BREAKPAD)
74 103
75 } // namespace 104 } // namespace
76 105
77 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( 106 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
78 const content::MainFunctionParams& parameters) 107 const content::MainFunctionParams& parameters)
79 : ChromeBrowserMainPartsPosix(parameters), 108 : ChromeBrowserMainPartsPosix(parameters),
80 did_pre_profile_init_(false) { 109 did_pre_profile_init_(false) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Release it now. Otherwise the FILE thread would be gone when we try to 154 // Release it now. Otherwise the FILE thread would be gone when we try to
126 // release it in the dtor and Valgrind would report a leak on almost ever 155 // release it in the dtor and Valgrind would report a leak on almost ever
127 // single browser_test. 156 // single browser_test.
128 removable_device_notifications_linux_ = NULL; 157 removable_device_notifications_linux_ = NULL;
129 #endif 158 #endif
130 159
131 media_transfer_protocol_device_observer_.reset(); 160 media_transfer_protocol_device_observer_.reset();
132 161
133 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); 162 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
134 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_android.cc ('k') | chrome/browser/chromeos/login/wizard_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698