diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 03:10:07 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-16 03:10:07 +0000 |
commit | 9742508529581c44056a836d10fa6cfd76ecca7b (patch) | |
tree | 6097ddf43758a19f18edf4c02b55d89616c90310 | |
parent | 6df6ec02bbb09f5c81e4bf9189bd7237eb2c4e1f (diff) | |
download | chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.zip chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.tar.gz chromium_src-9742508529581c44056a836d10fa6cfd76ecca7b.tar.bz2 |
Remove USE_LINUX_BREAKPAD ifdef since we don't need it for chromium anymore.
See thread "[chromium-dev] PSA: Breakpad is now compiled into
Chromium by default on Linux' for background
TBR=sbc@chromium.org, thakis@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/18770006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211755 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/process/memory.h | 6 | ||||
-rw-r--r-- | base/process/memory_linux.cc | 4 | ||||
-rw-r--r-- | base/process_util_linux.cc | 51 | ||||
-rw-r--r-- | breakpad/breakpad.gyp | 160 | ||||
-rw-r--r-- | build/all_android.gyp | 18 | ||||
-rw-r--r-- | build/common.gypi | 8 | ||||
-rw-r--r-- | chrome/app/breakpad_linux.h | 3 | ||||
-rw-r--r-- | chrome/app/chrome_main_delegate.cc | 16 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_android.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chrome_browser_main_linux.cc | 24 | ||||
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 11 | ||||
-rw-r--r-- | chrome/browser/chromeos/chrome_browser_main_chromeos.cc | 5 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/wizard_controller.cc | 7 | ||||
-rw-r--r-- | chrome/browser/crash_handler_host_linux.h | 25 | ||||
-rw-r--r-- | chrome/browser/crash_handler_host_linux_stub.cc | 82 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/first_run_dialog.cc | 7 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 45 | ||||
-rw-r--r-- | chrome/chrome_browser_chromeos.gypi | 18 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 5 | ||||
-rw-r--r-- | chrome/common/dump_without_crashing.cc | 6 | ||||
-rw-r--r-- | chrome/common/dump_without_crashing.h | 2 |
21 files changed, 191 insertions, 314 deletions
diff --git a/base/process/memory.h b/base/process/memory.h index d115a81..2ad1e50 100644 --- a/base/process/memory.h +++ b/base/process/memory.h @@ -31,10 +31,6 @@ BASE_EXPORT void EnableTerminationOnHeapCorruption(); // Turns on process termination if memory runs out. BASE_EXPORT void EnableTerminationOnOutOfMemory(); -#if defined(USE_LINUX_BREAKPAD) -BASE_EXPORT extern size_t g_oom_size; -#endif - #if defined(OS_WIN) // Returns the module handle to which an address belongs. The reference count // of the module is not incremented. @@ -42,6 +38,8 @@ BASE_EXPORT HMODULE GetModuleFromAddress(void* address); #endif #if defined(OS_LINUX) || defined(OS_ANDROID) +BASE_EXPORT extern size_t g_oom_size; + // The maximum allowed value for the OOM score. const int kMaxOomScore = 1000; diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc index ac43042..f81429b 100644 --- a/base/process/memory_linux.cc +++ b/base/process/memory_linux.cc @@ -14,16 +14,12 @@ namespace base { -#if defined(USE_LINUX_BREAKPAD) size_t g_oom_size = 0U; -#endif namespace { void OnNoMemorySize(size_t size) { -#if defined(USE_LINUX_BREAKPAD) g_oom_size = size; -#endif if (size != 0) LOG(FATAL) << "Out of memory, size = " << size; diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc new file mode 100644 index 0000000..b76f8c1 --- /dev/null +++ b/base/process_util_linux.cc @@ -0,0 +1,51 @@ +// Copyright (c) 2012 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 "base/process_util.h" + +#include <dirent.h> +#include <malloc.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/process/internal_linux.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "base/sys_info.h" +#include "base/threading/thread_restrictions.h" + +namespace base { + +size_t g_oom_size = 0U; + +const char kProcSelfExe[] = "/proc/self/exe"; + +ProcessId GetParentProcessId(ProcessHandle process) { + ProcessId pid = + internal::ReadProcStatsAndGetFieldAsInt(process, internal::VM_PPID); + if (pid) + return pid; + return -1; +} + +FilePath GetProcessExecutablePath(ProcessHandle process) { + FilePath stat_file = internal::GetProcPidDir(process).Append("exe"); + FilePath exe_name; + if (!file_util::ReadSymbolicLink(stat_file, &exe_name)) { + // No such process. Happens frequently in e.g. TerminateAllChromeProcesses + return FilePath(); + } + return exe_name; +} + +int GetNumberOfThreads(ProcessHandle process) { + return internal::ReadProcStatsAndGetFieldAsInt(process, + internal::VM_NUMTHREADS); +} + +} // namespace base diff --git a/breakpad/breakpad.gyp b/breakpad/breakpad.gyp index 66c590a..40151c1 100644 --- a/breakpad/breakpad.gyp +++ b/breakpad/breakpad.gyp @@ -339,95 +339,91 @@ '__ANDROID__', ], }], - # Tools needed for archiving build symbols. - ['linux_breakpad==1', { - 'targets': [ - { - 'target_name': 'symupload', - 'type': 'executable', + ], + # Tools needed for archiving build symbols. + 'targets': [ + { + 'target_name': 'symupload', + 'type': 'executable', - 'includes': ['breakpad_tools.gypi'], + 'includes': ['breakpad_tools.gypi'], - 'sources': [ - 'src/tools/linux/symupload/sym_upload.cc', - 'src/common/linux/http_upload.cc', - 'src/common/linux/http_upload.h', - ], - 'include_dirs': [ - 'src', - 'src/third_party', - ], - 'link_settings': { - 'libraries': [ - '-ldl', - ], - }, - }, - { - 'target_name': 'dump_syms', - 'type': 'executable', - 'conditions': [ - ['OS=="android"', { - 'toolsets': [ 'host' ], - }], - ], + 'sources': [ + 'src/tools/linux/symupload/sym_upload.cc', + 'src/common/linux/http_upload.cc', + 'src/common/linux/http_upload.h', + ], + 'include_dirs': [ + 'src', + 'src/third_party', + ], + 'link_settings': { + 'libraries': [ + '-ldl', + ], + }, + }, + { + 'target_name': 'dump_syms', + 'type': 'executable', + 'conditions': [ + ['OS=="android"', { + 'toolsets': [ 'host' ], + }], + ], - # dwarf2reader.cc uses dynamic_cast. Because we don't typically - # don't support RTTI, we enable it for this single target. Since - # dump_syms doesn't share any object files with anything else, - # this doesn't end up polluting Chrome itself. - 'cflags_cc!': ['-fno-rtti'], + # dwarf2reader.cc uses dynamic_cast. Because we don't typically + # don't support RTTI, we enable it for this single target. Since + # dump_syms doesn't share any object files with anything else, + # this doesn't end up polluting Chrome itself. + 'cflags_cc!': ['-fno-rtti'], - 'sources': [ - 'src/common/dwarf/bytereader.cc', - 'src/common/dwarf_cfi_to_module.cc', - 'src/common/dwarf_cfi_to_module.h', - 'src/common/dwarf_cu_to_module.cc', - 'src/common/dwarf_cu_to_module.h', - 'src/common/dwarf/dwarf2diehandler.cc', - 'src/common/dwarf/dwarf2reader.cc', - 'src/common/dwarf_line_to_module.cc', - 'src/common/dwarf_line_to_module.h', - 'src/common/language.cc', - 'src/common/language.h', - 'src/common/linux/dump_symbols.cc', - 'src/common/linux/dump_symbols.h', - 'src/common/linux/elf_symbols_to_module.cc', - 'src/common/linux/elf_symbols_to_module.h', - 'src/common/linux/elfutils.cc', - 'src/common/linux/elfutils.h', - 'src/common/linux/file_id.cc', - 'src/common/linux/file_id.h', - 'src/common/linux/linux_libc_support.cc', - 'src/common/linux/linux_libc_support.h', - 'src/common/linux/memory_mapped_file.cc', - 'src/common/linux/memory_mapped_file.h', - 'src/common/linux/guid_creator.h', - 'src/common/module.cc', - 'src/common/module.h', - 'src/common/stabs_reader.cc', - 'src/common/stabs_reader.h', - 'src/common/stabs_to_module.cc', - 'src/common/stabs_to_module.h', - 'src/tools/linux/dump_syms/dump_syms.cc', - ], + 'sources': [ + 'src/common/dwarf/bytereader.cc', + 'src/common/dwarf_cfi_to_module.cc', + 'src/common/dwarf_cfi_to_module.h', + 'src/common/dwarf_cu_to_module.cc', + 'src/common/dwarf_cu_to_module.h', + 'src/common/dwarf/dwarf2diehandler.cc', + 'src/common/dwarf/dwarf2reader.cc', + 'src/common/dwarf_line_to_module.cc', + 'src/common/dwarf_line_to_module.h', + 'src/common/language.cc', + 'src/common/language.h', + 'src/common/linux/dump_symbols.cc', + 'src/common/linux/dump_symbols.h', + 'src/common/linux/elf_symbols_to_module.cc', + 'src/common/linux/elf_symbols_to_module.h', + 'src/common/linux/elfutils.cc', + 'src/common/linux/elfutils.h', + 'src/common/linux/file_id.cc', + 'src/common/linux/file_id.h', + 'src/common/linux/linux_libc_support.cc', + 'src/common/linux/linux_libc_support.h', + 'src/common/linux/memory_mapped_file.cc', + 'src/common/linux/memory_mapped_file.h', + 'src/common/linux/guid_creator.h', + 'src/common/module.cc', + 'src/common/module.h', + 'src/common/stabs_reader.cc', + 'src/common/stabs_reader.h', + 'src/common/stabs_to_module.cc', + 'src/common/stabs_to_module.h', + 'src/tools/linux/dump_syms/dump_syms.cc', + ], - # Breakpad rev 583 introduced this flag. - # Using this define, stabs_reader.h will include a.out.h to - # build on Linux. - 'defines': [ - 'HAVE_A_OUT_H', - ], + # Breakpad rev 583 introduced this flag. + # Using this define, stabs_reader.h will include a.out.h to + # build on Linux. + 'defines': [ + 'HAVE_A_OUT_H', + ], - 'include_dirs': [ - 'src', - '..', - ], - }, + 'include_dirs': [ + 'src', + '..', ], - }], - ], - 'targets': [ + }, { 'target_name': 'breakpad_client', 'type': 'static_library', diff --git a/build/all_android.gyp b/build/all_android.gyp index eaac50c8..9bb408c 100644 --- a/build/all_android.gyp +++ b/build/all_android.gyp @@ -52,6 +52,13 @@ '../android_webview/android_webview.gyp:android_webview_unittests', '../base/android/jni_generator/jni_generator.gyp:jni_generator_tests', '../base/base.gyp:base_unittests', + '../breakpad/breakpad.gyp:breakpad_unittests', + # Also compile the tools needed to deal with minidumps, they are + # needed to run minidump tests upstream. + '../breakpad/breakpad.gyp:dump_syms#host', + '../breakpad/breakpad.gyp:symupload#host', + '../breakpad/breakpad.gyp:minidump_dump#host', + '../breakpad/breakpad.gyp:minidump_stackwalk#host', '../build/android/tests/multiple_proguards/multiple_proguards.gyp:multiple_proguards_test_apk', '../cc/cc_tests.gyp:cc_perftests_apk', '../cc/cc_tests.gyp:cc_unittests', @@ -80,17 +87,6 @@ '../chrome/chrome_resources.gyp:packed_resources', ], 'conditions': [ - ['linux_breakpad==1', { - 'dependencies': [ - '../breakpad/breakpad.gyp:breakpad_unittests', - # Also compile the tools needed to deal with minidumps, they are - # needed to run minidump tests upstream. - '../breakpad/breakpad.gyp:dump_syms#host', - '../breakpad/breakpad.gyp:symupload#host', - '../breakpad/breakpad.gyp:minidump_dump#host', - '../breakpad/breakpad.gyp:minidump_stackwalk#host' - ], - }], ['"<(gtest_target_type)"=="shared_library"', { 'dependencies': [ # Unit test bundles packaged as an apk. diff --git a/build/common.gypi b/build/common.gypi index 55d1ca3..154ad6c 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -643,7 +643,6 @@ ['OS=="linux" and target_arch=="arm" and chromeos==0', { # Set some defaults for arm/linux chrome builds - 'linux_breakpad%': 0, 'linux_use_tcmalloc%': 0, # sysroot needs to be an absolute path otherwise it generates # incorrect results when passed to pkg-config @@ -980,9 +979,6 @@ # Enable strict glibc debug mode. 'glibcxx_debug%': 0, - # Compile in Breakpad support by default so that it can be tested, - # even if it not enabled by default at runtime. - 'linux_breakpad%': 1, # And if we want to dump symbols for Breakpad-enabled builds. 'linux_dump_symbols%': 0, # And if we want to strip the binary after dumping symbols. @@ -1151,7 +1147,6 @@ 'disable_nacl%': 1, 'nacl_untrusted_build%': 0, 'linux_use_tcmalloc%': 0, - 'linux_breakpad%': 0, }], ['OS=="linux" and target_arch=="mipsel"', { 'sysroot%': '<(sysroot)', @@ -3345,9 +3340,6 @@ }], ], }], - ['linux_breakpad==1', { - 'defines': ['USE_LINUX_BREAKPAD'], - }], ['linux_dump_symbols==1', { 'cflags': [ '-g' ], 'conditions': [ diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h index ab213f8..6692736 100644 --- a/chrome/app/breakpad_linux.h +++ b/chrome/app/breakpad_linux.h @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Public interface for enabling Breakpad on Linux systems. This can be -// included in files that are not built with linux_breakpad=1. +// Public interface for enabling Breakpad on Linux systems. #ifndef CHROME_APP_BREAKPAD_LINUX_H_ #define CHROME_APP_BREAKPAD_LINUX_H_ diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index aafdd6d..fb0ab3a 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -48,13 +48,11 @@ #include "base/mac/mac_util.h" #include "base/mac/os_crash_dumps.h" #include "chrome/app/breakpad_mac.h" -#include "chrome/app/chrome_breakpad_client.h" #include "chrome/app/chrome_main_mac.h" #include "chrome/browser/mac/relauncher.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/mac/cfbundle_blocker.h" #include "chrome/common/mac/objc_zombie.h" -#include "components/breakpad/breakpad_client.h" #include "grit/chromium_strings.h" #include "ui/base/l10n/l10n_util_mac.h" #endif @@ -62,6 +60,8 @@ #if defined(OS_POSIX) #include <locale.h> #include <signal.h> +#include "chrome/app/chrome_breakpad_client.h" +#include "components/breakpad/breakpad_client.h" #endif #if !defined(DISABLE_NACL) && defined(OS_LINUX) @@ -89,10 +89,8 @@ #include "ui/base/x/x11_util.h" #endif -#if defined(USE_LINUX_BREAKPAD) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include "chrome/app/breakpad_linux.h" -#include "chrome/app/chrome_breakpad_client.h" -#include "components/breakpad/breakpad_client.h" #endif base::LazyInstance<chrome::ChromeContentBrowserClient> @@ -104,7 +102,7 @@ base::LazyInstance<chrome::ChromeContentUtilityClient> base::LazyInstance<chrome::ChromeContentPluginClient> g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; -#if defined(OS_MACOSX) || defined(USE_LINUX_BREAKPAD) +#if defined(OS_POSIX) base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER; #endif @@ -514,7 +512,7 @@ void ChromeMainDelegate::PreSandboxStartup() { std::string process_type = command_line.GetSwitchValueASCII(switches::kProcessType); -#if defined(OS_MACOSX) || defined(USE_LINUX_BREAKPAD) +#if defined(OS_POSIX) breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer()); #endif @@ -635,7 +633,7 @@ void ChromeMainDelegate::PreSandboxStartup() { #endif // defined(OS_MACOSX) } -#if defined(USE_LINUX_BREAKPAD) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain // sets this up for the browser process in a different manner. Zygotes // need to call InitCrashReporter() in RunZygote(). @@ -742,7 +740,7 @@ void ChromeMainDelegate::ZygoteForked() { SetUpProfilingShutdownHandler(); } -#if defined(USE_LINUX_BREAKPAD) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Needs to be called after we have chrome::DIR_USER_DATA. BrowserMain sets // this up for the browser process in a different manner. InitCrashReporter(); diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc index 3776811..bf96e89 100644 --- a/chrome/browser/chrome_browser_main_android.cc +++ b/chrome/browser/chrome_browser_main_android.cc @@ -28,7 +28,6 @@ ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { void ChromeBrowserMainPartsAndroid::PreProfileInit() { TRACE_EVENT0("startup", "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 @@ -47,7 +46,6 @@ void ChromeBrowserMainPartsAndroid::PreProfileInit() { InitCrashReporter(); crash_dump_manager_.reset(new CrashDumpManager()); } -#endif ChromeBrowserMainParts::PreProfileInit(); } diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc index 59fefb08..dd83909 100644 --- a/chrome/browser/chrome_browser_main_linux.cc +++ b/chrome/browser/chrome_browser_main_linux.cc @@ -4,21 +4,14 @@ #include "chrome/browser/chrome_browser_main_linux.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/metrics/metrics_service.h" - -#if !defined(OS_CHROMEOS) -#include "chrome/browser/storage_monitor/storage_monitor_linux.h" -#include "content/public/browser/browser_thread.h" -#endif - -#if defined(USE_LINUX_BREAKPAD) #include <stdlib.h> #include "base/command_line.h" #include "base/linux_util.h" #include "base/prefs/pref_service.h" #include "chrome/app/breakpad_linux.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/metrics/metrics_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" #include "chrome/common/pref_names.h" @@ -28,13 +21,13 @@ #include "chrome/browser/chromeos/settings/cros_settings_names.h" #include "chrome/common/chrome_version_info.h" #include "chromeos/chromeos_switches.h" +#else +#include "chrome/browser/storage_monitor/storage_monitor_linux.h" +#include "content/public/browser/browser_thread.h" #endif -#endif // defined(USE_LINUX_BREAKPAD) - namespace { -#if defined(USE_LINUX_BREAKPAD) #if !defined(OS_CHROMEOS) void GetLinuxDistroCallback() { base::GetLinuxDistro(); // Initialize base::linux_distro if needed. @@ -102,7 +95,6 @@ bool IsCrashReportingEnabled(const PrefService* local_state) { return breakpad_enabled; } -#endif // defined(USE_LINUX_BREAKPAD) } // namespace @@ -115,7 +107,6 @@ ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { } void ChromeBrowserMainPartsLinux::PreProfileInit() { -#if defined(USE_LINUX_BREAKPAD) #if !defined(OS_CHROMEOS) // Needs to be called after we have chrome::DIR_USER_DATA and // g_browser_process. This happens in PreCreateThreads. @@ -126,7 +117,6 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() { if (IsCrashReportingEnabled(local_state())) InitCrashReporter(); -#endif #if !defined(OS_CHROMEOS) const base::FilePath kDefaultMtabPath("/etc/mtab"); @@ -139,12 +129,8 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() { void ChromeBrowserMainPartsLinux::PostProfileInit() { ChromeBrowserMainPartsPosix::PostProfileInit(); -#if defined(USE_LINUX_BREAKPAD) g_browser_process->metrics_service()->RecordBreakpadRegistration( IsCrashReporterEnabled()); -#else - g_browser_process->metrics_service()->RecordBreakpadRegistration(false); -#endif } void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() { diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 8a36b69..ba3f684 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1293,16 +1293,17 @@ std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( CommandLine* command_line, int child_process_id) { -#if defined(USE_LINUX_BREAKPAD) +#if defined(OS_MACOSX) if (IsCrashReporterEnabled()) { command_line->AppendSwitchASCII(switches::kEnableCrashReporter, - child_process_logging::GetClientId() + "," + base::GetLinuxDistro()); + child_process_logging::GetClientId()); } -#elif defined(OS_MACOSX) +#elif defined(OS_POSIX) if (IsCrashReporterEnabled()) { command_line->AppendSwitchASCII(switches::kEnableCrashReporter, - child_process_logging::GetClientId()); + child_process_logging::GetClientId() + "," + base::GetLinuxDistro()); } + #endif // OS_MACOSX if (logging::DialogsAreSuppressed()) @@ -2402,7 +2403,6 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, FileDescriptor(f, true))); -#if defined(USE_LINUX_BREAKPAD) if (IsCrashReporterEnabled()) { f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id); if (f == base::kInvalidPlatformFileValue) { @@ -2413,7 +2413,6 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( FileDescriptor(f, true))); } } -#endif // defined(USE_LINUX_BREAKPAD) #else int crash_signal_fd = GetCrashSignalFD(command_line); diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 60e87c5..4a78f05 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -124,13 +124,10 @@ namespace chromeos { namespace { -#if defined(USE_LINUX_BREAKPAD) void ChromeOSVersionCallback(const std::string& version) { base::SetLinuxDistro(std::string("CrOS ") + version); } -#endif - class MessageLoopObserver : public base::MessageLoopForUI::Observer { virtual base::EventStatus WillProcessEvent( const base::NativeEvent& event) OVERRIDE { @@ -559,11 +556,9 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() { // TimezoneSettings and CrosSettings. WallpaperManager::Get()->AddObservers(); -#if defined(USE_LINUX_BREAKPAD) cros_version_loader_.GetVersion(VersionLoader::VERSION_FULL, base::Bind(&ChromeOSVersionCallback), &tracker_); -#endif storage_monitor_.reset(new StorageMonitorCros()); diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index f3bd28a..ff92afd 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -19,6 +19,7 @@ #include "base/prefs/pref_service.h" #include "base/threading/thread_restrictions.h" #include "base/values.h" +#include "chrome/app/breakpad_linux.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h" @@ -65,10 +66,6 @@ #include "ui/base/accelerators/accelerator.h" #include "ui/base/l10n/l10n_util.h" -#if defined(USE_LINUX_BREAKPAD) -#include "chrome/app/breakpad_linux.h" -#endif - using content::BrowserThread; namespace { @@ -498,7 +495,7 @@ void WizardController::OnEulaAccepted() { CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); if (uma_enabled) { -#if defined(USE_LINUX_BREAKPAD) && defined(GOOGLE_CHROME_BUILD) +#if defined(GOOGLE_CHROME_BUILD) // The crash reporter initialization needs IO to complete. base::ThreadRestrictions::ScopedAllowIO allow_io; InitCrashReporter(); diff --git a/chrome/browser/crash_handler_host_linux.h b/chrome/browser/crash_handler_host_linux.h index bcd9dd7..64a01d2 100644 --- a/chrome/browser/crash_handler_host_linux.h +++ b/chrome/browser/crash_handler_host_linux.h @@ -5,22 +5,19 @@ #ifndef CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ #define CHROME_BROWSER_CRASH_HANDLER_HOST_LINUX_H_ -#include "base/compiler_specific.h" -#include "base/message_loop.h" - -#if defined(USE_LINUX_BREAKPAD) #include <sys/types.h> #include <string> +#include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "base/message_loop.h" struct BreakpadInfo; namespace base { class Thread; } -#endif // defined(USE_LINUX_BREAKPAD) template <typename T> struct DefaultSingletonTraits; @@ -50,26 +47,21 @@ class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher, // MessageLoop::DestructionObserver impl: virtual void WillDestroyCurrentMessageLoop() OVERRIDE; -#if defined(USE_LINUX_BREAKPAD) // Whether we are shutting down or not. bool IsShuttingDown() const; -#endif protected: CrashHandlerHostLinux(); virtual ~CrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) // Only called in concrete subclasses. void InitCrashUploaderThread(); std::string process_type_; -#endif private: void Init(); -#if defined(USE_LINUX_BREAKPAD) // This is here on purpose to make CrashHandlerHostLinux abstract. virtual void SetProcessType() = 0; @@ -81,16 +73,13 @@ class CrashHandlerHostLinux : public base::MessageLoopForIO::Watcher, // Continue OnFileCanReadWithoutBlocking()'s work on the IO thread. void QueueCrashDumpTask(BreakpadInfo* info, int signal_fd); -#endif int process_socket_; int browser_socket_; -#if defined(USE_LINUX_BREAKPAD) base::MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; scoped_ptr<base::Thread> uploader_thread_; bool shutting_down_; -#endif #if defined(ADDRESS_SANITIZER) char* asan_report_str_; @@ -109,9 +98,7 @@ class ExtensionCrashHandlerHostLinux : public CrashHandlerHostLinux { ExtensionCrashHandlerHostLinux(); virtual ~ExtensionCrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) virtual void SetProcessType() OVERRIDE; -#endif DISALLOW_COPY_AND_ASSIGN(ExtensionCrashHandlerHostLinux); }; @@ -126,9 +113,7 @@ class GpuCrashHandlerHostLinux : public CrashHandlerHostLinux { GpuCrashHandlerHostLinux(); virtual ~GpuCrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) virtual void SetProcessType() OVERRIDE; -#endif DISALLOW_COPY_AND_ASSIGN(GpuCrashHandlerHostLinux); }; @@ -143,9 +128,7 @@ class PluginCrashHandlerHostLinux : public CrashHandlerHostLinux { PluginCrashHandlerHostLinux(); virtual ~PluginCrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) virtual void SetProcessType() OVERRIDE; -#endif DISALLOW_COPY_AND_ASSIGN(PluginCrashHandlerHostLinux); }; @@ -160,9 +143,7 @@ class PpapiCrashHandlerHostLinux : public CrashHandlerHostLinux { PpapiCrashHandlerHostLinux(); virtual ~PpapiCrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) virtual void SetProcessType() OVERRIDE; -#endif DISALLOW_COPY_AND_ASSIGN(PpapiCrashHandlerHostLinux); }; @@ -177,9 +158,7 @@ class RendererCrashHandlerHostLinux : public CrashHandlerHostLinux { RendererCrashHandlerHostLinux(); virtual ~RendererCrashHandlerHostLinux(); -#if defined(USE_LINUX_BREAKPAD) virtual void SetProcessType() OVERRIDE; -#endif DISALLOW_COPY_AND_ASSIGN(RendererCrashHandlerHostLinux); }; diff --git a/chrome/browser/crash_handler_host_linux_stub.cc b/chrome/browser/crash_handler_host_linux_stub.cc deleted file mode 100644 index fc81c27..0000000 --- a/chrome/browser/crash_handler_host_linux_stub.cc +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2012 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. - -#include "chrome/browser/crash_handler_host_linux.h" - -#include "base/memory/singleton.h" - -CrashHandlerHostLinux::CrashHandlerHostLinux() - : process_socket_(-1), - browser_socket_(-1) { -} - -CrashHandlerHostLinux::~CrashHandlerHostLinux() { -} - -void CrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) { -} - -void CrashHandlerHostLinux::OnFileCanWriteWithoutBlocking(int fd) { -} - -void CrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { -} - -ExtensionCrashHandlerHostLinux::ExtensionCrashHandlerHostLinux() { -} - -ExtensionCrashHandlerHostLinux::~ExtensionCrashHandlerHostLinux() { -} - -// static -ExtensionCrashHandlerHostLinux* ExtensionCrashHandlerHostLinux::GetInstance() { - return Singleton<ExtensionCrashHandlerHostLinux>::get(); -} - -GpuCrashHandlerHostLinux::GpuCrashHandlerHostLinux() { -} - -GpuCrashHandlerHostLinux::~GpuCrashHandlerHostLinux() { -} - -// static -GpuCrashHandlerHostLinux* GpuCrashHandlerHostLinux::GetInstance() { - return Singleton<GpuCrashHandlerHostLinux>::get(); -} - -PluginCrashHandlerHostLinux::PluginCrashHandlerHostLinux() { -} - -PluginCrashHandlerHostLinux::~PluginCrashHandlerHostLinux() { -} - -// static -PluginCrashHandlerHostLinux* PluginCrashHandlerHostLinux::GetInstance() { - return Singleton<PluginCrashHandlerHostLinux>::get(); -} - -PpapiCrashHandlerHostLinux::PpapiCrashHandlerHostLinux() { -} - -PpapiCrashHandlerHostLinux::~PpapiCrashHandlerHostLinux() { -} - -// static -PpapiCrashHandlerHostLinux* PpapiCrashHandlerHostLinux::GetInstance() { - return Singleton<PpapiCrashHandlerHostLinux>::get(); -} - -RendererCrashHandlerHostLinux::RendererCrashHandlerHostLinux() { -} - -RendererCrashHandlerHostLinux::~RendererCrashHandlerHostLinux() { -} - -// static -RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { - return Singleton<RendererCrashHandlerHostLinux>::get(); -} diff --git a/chrome/browser/ui/gtk/first_run_dialog.cc b/chrome/browser/ui/gtk/first_run_dialog.cc index a5b7a02..cfb59de 100644 --- a/chrome/browser/ui/gtk/first_run_dialog.cc +++ b/chrome/browser/ui/gtk/first_run_dialog.cc @@ -10,6 +10,7 @@ #include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/app/breakpad_linux.h" #include "chrome/browser/first_run/first_run_dialog.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/process_singleton.h" @@ -28,10 +29,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#if defined(USE_LINUX_BREAKPAD) -#include "chrome/app/breakpad_linux.h" -#endif - #if defined(GOOGLE_CHROME_BUILD) #include "base/prefs/pref_service.h" #include "chrome/browser/browser_process.h" @@ -169,10 +166,8 @@ void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) { // Check if user has opted into reporting. if (report_crashes_ && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(report_crashes_))) { -#if defined(USE_LINUX_BREAKPAD) if (GoogleUpdateSettings::SetCollectStatsConsent(true)) InitCrashReporter(); -#endif } else { GoogleUpdateSettings::SetCollectStatsConsent(false); } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index c8ab9b7..e1cd866 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2783,32 +2783,24 @@ }, }], ['os_posix == 1 and OS != "mac" and OS != "ios"', { - 'sources': [ 'browser/crash_handler_host_linux.h', ], - 'conditions': [ - ['linux_breakpad==1', { - 'sources': [ - 'app/breakpad_linux.cc', - 'app/breakpad_linux.h', - 'app/chrome_breakpad_client.cc', - 'app/chrome_breakpad_client.h', - 'browser/crash_handler_host_linux.cc', - ], - 'dependencies': [ - '../breakpad/breakpad.gyp:breakpad_client', - '../components/components.gyp:breakpad_component', - # make sure file_version_info_linux.h is generated first. - 'common', - ], - 'include_dirs': [ - # breakpad_linux.cc uses generated file_version_info_linux.h. - '<(SHARED_INTERMEDIATE_DIR)', - '../breakpad/src', - ], - }, { # linux_breakpad==0 - 'sources': [ - 'browser/crash_handler_host_linux_stub.cc', - ], - }], + 'sources': [ + 'app/breakpad_linux.cc', + 'app/breakpad_linux.h', + 'app/chrome_breakpad_client.cc', + 'app/chrome_breakpad_client.h', + 'browser/crash_handler_host_linux.cc', + 'browser/crash_handler_host_linux.h', + ], + 'dependencies': [ + '../breakpad/breakpad.gyp:breakpad_client', + '../components/components.gyp:breakpad_component', + # make sure file_version_info_linux.h is generated first. + 'common', + ], + 'include_dirs': [ + # breakpad_linux.cc uses generated file_version_info_linux.h. + '<(SHARED_INTERMEDIATE_DIR)', + '../breakpad/src', ], }], ['use_nss==1', { @@ -3200,7 +3192,6 @@ 'sources/': [ ['include', '^app/breakpad_linux\\.cc$'], ['include', '^browser/crash_handler_host_linux\\.cc$'], - ['include', '^browser/crash_handler_host_linux_stub\\.cc$'], ], }], ], diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 7d9ca8e..1ef1590 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -44,6 +44,7 @@ 'safe_browsing_proto', 'safe_browsing_report_proto', 'variations_seed_proto', + '../breakpad/breakpad.gyp:breakpad_client', '../build/linux/system.gyp:dbus', '../chromeos/chromeos.gyp:chromeos', '../chromeos/chromeos.gyp:chromeos_memory', @@ -107,6 +108,11 @@ 'export_dependent_settings': [ '../sync/sync.gyp:sync', ], + 'include_dirs': [ + # breakpad_linux.cc uses generated file_version_info_linux.h. + '<(SHARED_INTERMEDIATE_DIR)', + '../breakpad/src', + ], 'sources': [ # All .cc, .h, .m, and .mm files under browser/chromeos, except for tests # and mocks. @@ -923,18 +929,6 @@ '../ui/gl/gl.gyp:gl', ], }], - ['linux_breakpad==1', { - 'dependencies': [ - '../breakpad/breakpad.gyp:breakpad_client', - # make sure file_version_info_linux.h is generated first. - 'common', - ], - 'include_dirs': [ - # breakpad_linux.cc uses generated file_version_info_linux.h. - '<(SHARED_INTERMEDIATE_DIR)', - '../breakpad/src', - ], - }], ['use_aura==1',{ 'dependencies': [ '../build/linux/system.gyp:dbus', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 6579173..34470b6 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2233,9 +2233,8 @@ { # To run the tests from page_load_test.cc on Linux, we need to: # - # a) Build with Breakpad (GYP_DEFINES="linux_chromium_breakpad=1") - # b) Run with CHROME_HEADLESS=1 to generate crash dumps. - # c) Strip the binary if it's a debug build. (binary may be over 2GB) + # a) Run with CHROME_HEADLESS=1 to generate crash dumps. + # b) Strip the binary if it's a debug build. (binary may be over 2GB) 'target_name': 'reliability_tests', 'type': 'executable', 'dependencies': [ diff --git a/chrome/common/dump_without_crashing.cc b/chrome/common/dump_without_crashing.cc index 75023d9..ea82f6a 100644 --- a/chrome/common/dump_without_crashing.cc +++ b/chrome/common/dump_without_crashing.cc @@ -15,7 +15,7 @@ namespace { -#if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) +#if defined(OS_POSIX) // Pointer to the function that's called by DumpWithoutCrashing() to dump the // process's memory. void (*dump_without_crashing_function_)() = NULL; @@ -34,7 +34,7 @@ void DumpWithoutCrashing() { "DumpProcess")); if (DumpProcess) DumpProcess(); -#elif defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) +#elif defined(OS_POSIX) if (dump_without_crashing_function_) (*dump_without_crashing_function_)(); #else @@ -42,7 +42,7 @@ void DumpWithoutCrashing() { #endif } -#if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) +#if defined(OS_POSIX) void SetDumpWithoutCrashingFunction(void (*function)()) { dump_without_crashing_function_ = function; } diff --git a/chrome/common/dump_without_crashing.h b/chrome/common/dump_without_crashing.h index fdf6e07..dd5299b 100644 --- a/chrome/common/dump_without_crashing.h +++ b/chrome/common/dump_without_crashing.h @@ -12,7 +12,7 @@ namespace logging { // Handler to silently dump the current process without crashing. void DumpWithoutCrashing(); -#if defined(USE_LINUX_BREAKPAD) || defined(OS_MACOSX) +#if defined(OS_POSIX) // Sets a function that'll be invoked to dump the current process when // DumpWithoutCrashing() is called. void SetDumpWithoutCrashingFunction(void (*function)()); |