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

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

Issue 18770006: Remove USE_LINUX_BREAKPAD ifdef since we don't need it for chromium anymore. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lei's comments + sync Created 7 years, 5 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/browser_process.h"
8 #include "chrome/browser/metrics/metrics_service.h"
9
10 #if !defined(OS_CHROMEOS)
11 #include "chrome/browser/storage_monitor/storage_monitor_linux.h"
12 #include "content/public/browser/browser_thread.h"
13 #endif
14
15 #if defined(USE_LINUX_BREAKPAD)
16 #include <stdlib.h> 7 #include <stdlib.h>
17 8
18 #include "base/command_line.h" 9 #include "base/command_line.h"
19 #include "base/linux_util.h" 10 #include "base/linux_util.h"
20 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
21 #include "chrome/app/breakpad_linux.h" 12 #include "chrome/app/breakpad_linux.h"
13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/metrics/metrics_service.h"
22 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/env_vars.h" 16 #include "chrome/common/env_vars.h"
24 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
25 18
26 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/chromeos/settings/cros_settings.h" 20 #include "chrome/browser/chromeos/settings/cros_settings.h"
28 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 21 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
29 #include "chrome/common/chrome_version_info.h" 22 #include "chrome/common/chrome_version_info.h"
30 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
24 #else
25 #include "chrome/browser/storage_monitor/storage_monitor_linux.h"
26 #include "content/public/browser/browser_thread.h"
31 #endif 27 #endif
32 28
33 #endif // defined(USE_LINUX_BREAKPAD)
34
35 namespace { 29 namespace {
36 30
37 #if defined(USE_LINUX_BREAKPAD)
38 #if !defined(OS_CHROMEOS) 31 #if !defined(OS_CHROMEOS)
39 void GetLinuxDistroCallback() { 32 void GetLinuxDistroCallback() {
40 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. 33 base::GetLinuxDistro(); // Initialize base::linux_distro if needed.
41 } 34 }
42 #endif 35 #endif
43 36
44 bool IsCrashReportingEnabled(const PrefService* local_state) { 37 bool IsCrashReportingEnabled(const PrefService* local_state) {
45 // Check whether we should initialize the crash reporter. It may be disabled 38 // Check whether we should initialize the crash reporter. It may be disabled
46 // through configuration policy or user preference. It must be disabled for 39 // through configuration policy or user preference. It must be disabled for
47 // Guest mode on Chrome OS in Stable channel. 40 // Guest mode on Chrome OS in Stable channel.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // instead. 88 // instead.
96 if (is_chrome_build && !breakpad_enabled) 89 if (is_chrome_build && !breakpad_enabled)
97 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; 90 breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
98 if (!breakpad_enabled) 91 if (!breakpad_enabled)
99 breakpad_enabled = CommandLine::ForCurrentProcess()->HasSwitch( 92 breakpad_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
100 switches::kEnableCrashReporterForTesting); 93 switches::kEnableCrashReporterForTesting);
101 } 94 }
102 95
103 return breakpad_enabled; 96 return breakpad_enabled;
104 } 97 }
105 #endif // defined(USE_LINUX_BREAKPAD)
106 98
107 } // namespace 99 } // namespace
108 100
109 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( 101 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
110 const content::MainFunctionParams& parameters) 102 const content::MainFunctionParams& parameters)
111 : ChromeBrowserMainPartsPosix(parameters) { 103 : ChromeBrowserMainPartsPosix(parameters) {
112 } 104 }
113 105
114 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { 106 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
115 } 107 }
116 108
117 void ChromeBrowserMainPartsLinux::PreProfileInit() { 109 void ChromeBrowserMainPartsLinux::PreProfileInit() {
118 #if defined(USE_LINUX_BREAKPAD)
119 #if !defined(OS_CHROMEOS) 110 #if !defined(OS_CHROMEOS)
120 // Needs to be called after we have chrome::DIR_USER_DATA and 111 // Needs to be called after we have chrome::DIR_USER_DATA and
121 // g_browser_process. This happens in PreCreateThreads. 112 // g_browser_process. This happens in PreCreateThreads.
122 content::BrowserThread::PostTask(content::BrowserThread::FILE, 113 content::BrowserThread::PostTask(content::BrowserThread::FILE,
123 FROM_HERE, 114 FROM_HERE,
124 base::Bind(&GetLinuxDistroCallback)); 115 base::Bind(&GetLinuxDistroCallback));
125 #endif 116 #endif
126 117
127 if (IsCrashReportingEnabled(local_state())) 118 if (IsCrashReportingEnabled(local_state()))
128 InitCrashReporter(); 119 InitCrashReporter();
129 #endif
130 120
131 #if !defined(OS_CHROMEOS) 121 #if !defined(OS_CHROMEOS)
132 const base::FilePath kDefaultMtabPath("/etc/mtab"); 122 const base::FilePath kDefaultMtabPath("/etc/mtab");
133 storage_monitor_.reset(new chrome::StorageMonitorLinux(kDefaultMtabPath)); 123 storage_monitor_.reset(new chrome::StorageMonitorLinux(kDefaultMtabPath));
134 #endif 124 #endif
135 125
136 ChromeBrowserMainPartsPosix::PreProfileInit(); 126 ChromeBrowserMainPartsPosix::PreProfileInit();
137 } 127 }
138 128
139 void ChromeBrowserMainPartsLinux::PostProfileInit() { 129 void ChromeBrowserMainPartsLinux::PostProfileInit() {
140 ChromeBrowserMainPartsPosix::PostProfileInit(); 130 ChromeBrowserMainPartsPosix::PostProfileInit();
141 131
142 #if defined(USE_LINUX_BREAKPAD)
143 g_browser_process->metrics_service()->RecordBreakpadRegistration( 132 g_browser_process->metrics_service()->RecordBreakpadRegistration(
144 IsCrashReporterEnabled()); 133 IsCrashReporterEnabled());
145 #else
146 g_browser_process->metrics_service()->RecordBreakpadRegistration(false);
147 #endif
148 } 134 }
149 135
150 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { 136 void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {
151 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); 137 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
152 138
153 #if !defined(OS_CHROMEOS) 139 #if !defined(OS_CHROMEOS)
154 // Delete it now. Otherwise the FILE thread would be gone when we try to 140 // Delete it now. Otherwise the FILE thread would be gone when we try to
155 // release it in the dtor and Valgrind would report a leak on almost every 141 // release it in the dtor and Valgrind would report a leak on almost every
156 // single browser_test. 142 // single browser_test.
157 storage_monitor_.reset(); 143 storage_monitor_.reset();
158 #endif 144 #endif
159 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698