summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PRESUBMIT.py1
-rw-r--r--chrome/app/chrome_main_delegate.cc12
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/chrome_browser_main_mac.mm4
-rw-r--r--chrome/browser/chrome_content_browser_client.cc7
-rw-r--r--chrome/browser/ui/cocoa/first_run_dialog.mm8
-rw-r--r--chrome/chrome_dll.gypi6
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--components/breakpad.gypi21
-rw-r--r--components/breakpad/DEPS3
-rw-r--r--components/breakpad/breakpad_mac.h (renamed from chrome/app/breakpad_mac.h)12
-rw-r--r--components/breakpad/breakpad_mac.mm (renamed from chrome/app/breakpad_mac.mm)25
-rw-r--r--components/breakpad/breakpad_mac_stubs.mm (renamed from chrome/app/breakpad_mac_stubs.mm)6
14 files changed, 66 insertions, 43 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 701fd21..921615e 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -157,6 +157,7 @@ _BANNED_CPP_FUNCTIONS = (
),
True,
(
+ r"^components[\\\/]breakpad[\\\/]breakpad_mac\.mm$",
r"^content[\\\/]shell[\\\/]browser[\\\/]shell_browser_main\.cc$",
r"^content[\\\/]shell[\\\/]browser[\\\/]shell_message_filter\.cc$",
r"^net[\\\/]disk_cache[\\\/]cache_util\.cc$",
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 100014d..bcb1e34 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -41,9 +41,9 @@
#include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
-#include <algorithm>
#include <atlbase.h>
#include <malloc.h>
+#include <algorithm>
#include "base/strings/string_util.h"
#include "chrome/common/child_process_logging.h"
#include "sandbox/win/src/sandbox.h"
@@ -54,12 +54,12 @@
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#include "base/mac/os_crash_dumps.h"
-#include "chrome/app/breakpad_mac.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_mac.h"
#include "grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
#endif
@@ -504,7 +504,7 @@ void ChromeMainDelegate::InitMacCrashReporter(const CommandLine& command_line,
// CommandLine::Init() and chrome::RegisterPathProvider(). Ideally,
// Breakpad initialization could occur sooner, preferably even before the
// framework dylib is even loaded, to catch potential early crashes.
- InitCrashReporter();
+ breakpad::InitCrashReporter();
#if defined(NDEBUG)
bool is_debug_build = false;
@@ -529,7 +529,7 @@ void ChromeMainDelegate::InitMacCrashReporter(const CommandLine& command_line,
if (!command_line.HasSwitch(switches::kDisableBreakpad)) {
bool disable_apple_crash_reporter = is_debug_build ||
base::mac::IsBackgroundOnlyProcess();
- if (!IsCrashReporterEnabled() && disable_apple_crash_reporter) {
+ if (!breakpad::IsCrashReporterEnabled() && disable_apple_crash_reporter) {
base::mac::DisableOSCrashDumps();
}
}
@@ -580,8 +580,8 @@ void ChromeMainDelegate::InitMacCrashReporter(const CommandLine& command_line,
<< "Main application forbids --type, saw " << process_type;
}
- if (IsCrashReporterEnabled())
- InitCrashProcessInfo();
+ if (breakpad::IsCrashReporterEnabled())
+ breakpad::InitCrashProcessInfo();
}
#endif // defined(OS_MACOSX)
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 91e8e0c..5c79b23 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -9,6 +9,7 @@ include_rules = [
"+components/autofill/core/browser",
"+components/autofill/core/common",
"+components/auto_login_parser",
+ "+components/breakpad",
"+components/browser_context_keyed_service",
"+components/nacl/common",
"+components/navigation_interception",
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm
index 0303b84..98b225e 100644
--- a/chrome/browser/chrome_browser_main_mac.mm
+++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -14,7 +14,6 @@
#include "base/mac/scoped_nsobject.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
-#include "chrome/app/breakpad_mac.h"
#import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/browser_process.h"
#import "chrome/browser/chrome_browser_application_mac.h"
@@ -24,6 +23,7 @@
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "components/breakpad/breakpad_mac.h"
#include "content/public/common/main_function_params.h"
#include "content/public/common/result_codes.h"
#include "ui/base/l10n/l10n_util_mac.h"
@@ -269,7 +269,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
void ChromeBrowserMainPartsMac::PostProfileInit() {
ChromeBrowserMainPartsPosix::PostProfileInit();
g_browser_process->metrics_service()->RecordBreakpadRegistration(
- IsCrashReporterEnabled());
+ breakpad::IsCrashReporterEnabled());
}
void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 4713562..49fe6b1 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -16,7 +16,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
-#include "chrome/app/breakpad_mac.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_process.h"
@@ -150,6 +149,7 @@
#elif defined(OS_MACOSX)
#include "chrome/browser/chrome_browser_main_mac.h"
#include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h"
+#include "components/breakpad/breakpad_mac.h"
#elif defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
#include "chrome/browser/chromeos/drive/file_system_backend_delegate.h"
@@ -172,6 +172,7 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/linux_util.h"
+#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/crash_handler_host_linux.h"
#endif
@@ -249,6 +250,10 @@ using extensions::Extension;
using extensions::Manifest;
using message_center::NotifierId;
+#if defined(OS_MACOSX)
+using breakpad::IsCrashReporterEnabled;
+#endif
+
namespace {
// Cached version of the locale so we can return the locale on the I/O
diff --git a/chrome/browser/ui/cocoa/first_run_dialog.mm b/chrome/browser/ui/cocoa/first_run_dialog.mm
index 6fc2b67..2ffa267 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog.mm
+++ b/chrome/browser/ui/cocoa/first_run_dialog.mm
@@ -26,10 +26,10 @@
#if defined(GOOGLE_CHROME_BUILD)
#include "base/prefs/pref_service.h"
-#import "chrome/app/breakpad_mac.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
+#import "components/breakpad/breakpad_mac.h"
#endif
@interface FirstRunDialogController (PrivateMethods)
@@ -105,9 +105,9 @@ bool ShowFirstRun(Profile* profile) {
// Breakpad is normally enabled very early in the startup process. However,
// on the first run it may not have been enabled due to the missing opt-in
// from the user. If the user agreed now, enable breakpad if necessary.
- if (!IsCrashReporterEnabled() && stats_enabled) {
- InitCrashReporter();
- InitCrashProcessInfo();
+ if (!breakpad::IsCrashReporterEnabled() && stats_enabled) {
+ breakpad::InitCrashReporter();
+ breakpad::InitCrashProcessInfo();
}
// If selected set as default browser.
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index 967cec8..94d9294 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -283,8 +283,6 @@
'app/policy/cloud_policy_codegen.gyp:policy',
],
'sources': [
- 'app/breakpad_mac.mm',
- 'app/breakpad_mac.h',
'app/chrome_breakpad_client.cc',
'app/chrome_breakpad_client.h',
'app/chrome_breakpad_client_mac.mm',
@@ -294,10 +292,6 @@
'dependencies': [
'../components/components.gyp:breakpad_stubs',
],
- 'sources': [
- 'app/breakpad_mac_stubs.mm',
- 'app/breakpad_mac.h',
- ],
}], # mac_breakpad_compiled_in
['internal_pdf', {
'dependencies': [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 73f8206..d97083f 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -940,7 +940,6 @@
'../remoting/test/remote_desktop_browsertest.h',
'../remoting/test/waiter.cc',
'../remoting/test/waiter.h',
- 'app/breakpad_mac_stubs.mm',
'app/chrome_command_ids.h',
'app/chrome_dll.rc',
'app/chrome_dll_resource.h',
@@ -1961,7 +1960,6 @@
'sources': [
'../components/autofill/content/renderer/test_password_autofill_agent.cc',
'../components/autofill/content/renderer/test_password_autofill_agent.h',
- 'app/breakpad_mac_stubs.mm',
'app/chrome_command_ids.h',
'app/chrome_dll.rc',
'app/chrome_dll_resource.h',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index ce0ae41..3a13182 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -39,7 +39,6 @@
'..',
],
'sources': [
- 'app/breakpad_mac_stubs.mm',
'app/chrome_main_delegate.cc',
'app/chrome_main_delegate.h',
'browser/android/mock_google_location_settings_helper.cc',
diff --git a/components/breakpad.gypi b/components/breakpad.gypi
index c893870..c79d815 100644
--- a/components/breakpad.gypi
+++ b/components/breakpad.gypi
@@ -12,6 +12,8 @@
'sources': [
'breakpad/breakpad_client.cc',
'breakpad/breakpad_client.h',
+ 'breakpad/breakpad_mac.h',
+ 'breakpad/breakpad_mac.mm',
],
}],
],
@@ -26,6 +28,14 @@
'dependencies': [
'../base/base.gyp:base',
],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'dependencies': [
+ '../breakpad/breakpad.gyp:breakpad',
+ '../content/content.gyp:content_common',
+ ],
+ }],
+ ],
},
],
'conditions': [
@@ -51,16 +61,17 @@
['OS=="mac"', {
'targets': [
{
- # TODO(jochen): for now, this target is a copy of breakpad, however,
- # in the future, it should provide a dummy implementation for Mac.
'target_name': 'breakpad_stubs',
'type': 'static_library',
- 'variables': {
- 'breakpad_component_target': 1,
- },
'dependencies': [
'../base/base.gyp:base',
],
+ 'sources': [
+ 'breakpad/breakpad_client.cc',
+ 'breakpad/breakpad_client.h',
+ 'breakpad/breakpad_mac.h',
+ 'breakpad/breakpad_mac_stubs.mm',
+ ],
},
],
}],
diff --git a/components/breakpad/DEPS b/components/breakpad/DEPS
new file mode 100644
index 0000000..9ebc497
--- /dev/null
+++ b/components/breakpad/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+breakpad",
+]
diff --git a/chrome/app/breakpad_mac.h b/components/breakpad/breakpad_mac.h
index ed3c1e2..362cee2 100644
--- a/chrome/app/breakpad_mac.h
+++ b/components/breakpad/breakpad_mac.h
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_APP_BREAKPAD_MAC_H_
-#define CHROME_APP_BREAKPAD_MAC_H_
+#ifndef COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
+#define COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
-// This header defines the Chrome entry points for Breakpad integration.
+// This header defines the entry points for Breakpad integration.
+
+namespace breakpad {
// Initializes Breakpad.
void InitCrashReporter();
@@ -18,4 +20,6 @@ void InitCrashProcessInfo();
// Is Breakpad enabled?
bool IsCrashReporterEnabled();
-#endif // CHROME_APP_BREAKPAD_MAC_H_
+} // namespace breakpad
+
+#endif // COMPONENTS_BREAKPAD_BREAKPAD_MAC_H_
diff --git a/chrome/app/breakpad_mac.mm b/components/breakpad/breakpad_mac.mm
index 90a786b..0f6c097 100644
--- a/chrome/app/breakpad_mac.mm
+++ b/components/breakpad/breakpad_mac.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "chrome/app/breakpad_mac.h"
+#import "components/breakpad/breakpad_mac.h"
#include <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
@@ -23,8 +23,10 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#import "breakpad/src/client/mac/Framework/Breakpad.h"
-#include "content/public/common/content_switches.h"
#include "components/breakpad/breakpad_client.h"
+#include "content/public/common/content_switches.h"
+
+namespace breakpad {
namespace {
@@ -164,16 +166,15 @@ void InitCrashReporter() {
if (is_browser) {
// Since the configuration management infrastructure is possibly not
// initialized when this code runs, read the policy preference directly.
- if (breakpad::GetBreakpadClient()->ReportingIsEnforcedByPolicy()) {
+ if (GetBreakpadClient()->ReportingIsEnforcedByPolicy()) {
// Controlled by configuration manangement.
enable_breakpad = true;
} else {
// Controlled by the user. The crash reporter may be enabled by
// preference or through an environment variable, but the kDisableBreakpad
// switch overrides both.
- enable_breakpad =
- breakpad::GetBreakpadClient()->GetCollectStatsConsent() ||
- breakpad::GetBreakpadClient()->IsRunningUnattended();
+ enable_breakpad = GetBreakpadClient()->GetCollectStatsConsent() ||
+ GetBreakpadClient()->IsRunningUnattended();
enable_breakpad &= !command_line->HasSwitch(switches::kDisableBreakpad);
}
} else {
@@ -216,7 +217,7 @@ void InitCrashReporter() {
[breakpad_config setObject:@"NO" forKey:@BREAKPAD_SEND_AND_EXIT];
base::FilePath dir_crash_dumps;
- breakpad::GetBreakpadClient()->GetCrashDumpLocation(&dir_crash_dumps);
+ GetBreakpadClient()->GetCrashDumpLocation(&dir_crash_dumps);
[breakpad_config setObject:base::SysUTF8ToNSString(dir_crash_dumps.value())
forKey:@BREAKPAD_DUMP_DIRECTORY];
@@ -230,7 +231,7 @@ void InitCrashReporter() {
// Initialize the scoped crash key system.
base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValueImpl,
&ClearCrashKeyValueImpl);
- breakpad::GetBreakpadClient()->RegisterCrashKeys();
+ GetBreakpadClient()->RegisterCrashKeys();
// Set Breakpad metadata values. These values are added to Info.plist during
// the branded Google Chrome.app build.
@@ -242,11 +243,11 @@ void InitCrashReporter() {
// Get the guid from the command line switch.
std::string guid =
command_line->GetSwitchValueASCII(switches::kEnableCrashReporter);
- breakpad::GetBreakpadClient()->SetClientID(guid);
+ GetBreakpadClient()->SetClientID(guid);
}
logging::SetLogMessageHandler(&FatalMessageHandler);
- breakpad::GetBreakpadClient()->SetDumpWithoutCrashingFunction(
+ GetBreakpadClient()->SetDumpWithoutCrashingFunction(
&DumpHelper::DumpWithoutCrashing);
// abort() sends SIGABRT, which breakpad does not intercept.
@@ -272,8 +273,10 @@ void InitCrashProcessInfo() {
process_type = base::SysUTF8ToNSString(process_type_switch);
}
- breakpad::GetBreakpadClient()->InstallAdditionalFilters(gBreakpadRef);
+ GetBreakpadClient()->InstallAdditionalFilters(gBreakpadRef);
// Store process type in crash dump.
SetCrashKeyValue(@"ptype", process_type);
}
+
+} // namespace breakpad
diff --git a/chrome/app/breakpad_mac_stubs.mm b/components/breakpad/breakpad_mac_stubs.mm
index f8a651a..3ee5282 100644
--- a/chrome/app/breakpad_mac_stubs.mm
+++ b/components/breakpad/breakpad_mac_stubs.mm
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "chrome/app/breakpad_mac.h"
+#import "components/breakpad/breakpad_mac.h"
#import <Foundation/Foundation.h>
// Stubbed out versions of breakpad integration functions so we can compile
// without linking in Breakpad.
+namespace breakpad {
+
bool IsCrashReporterEnabled() {
return false;
}
@@ -18,3 +20,5 @@ void InitCrashProcessInfo() {
void InitCrashReporter() {
}
+
+} // namespace breakpad