diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-11 11:29:49 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-11 11:29:49 +0000 |
commit | 812befe3f00189ee161b5f412541dd0ba8840b79 (patch) | |
tree | a96f8ab57c5b81fef25e0c5af9aafa39e3d989fa /chrome/app | |
parent | 2c7a350921a14e0d6afb3cb24c7e36dbde141459 (diff) | |
download | chromium_src-812befe3f00189ee161b5f412541dd0ba8840b79.zip chromium_src-812befe3f00189ee161b5f412541dd0ba8840b79.tar.gz chromium_src-812befe3f00189ee161b5f412541dd0ba8840b79.tar.bz2 |
Refactor Mac crash key reporting - move to base/mac/crash_logging.{h,mm}
Breakpad support currently resides in chrome/app/breakpad_mac.* this makes it inaccessible to lower level code that would also like to set crash keys e.g. The sandboxing infrastructure.
This CL refactors the crash key reporting code to reside in base/mac.
Logging is also added to the Sandbox code to try to track down the cause of crbug.com/94758.
BUG=95272, 94758
TEST=On official builds crash logs should contain crash keys e.g. OS version.
Review URL: http://codereview.chromium.org/7849011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r-- | chrome/app/breakpad_mac.h | 26 | ||||
-rw-r--r-- | chrome/app/breakpad_mac.mm | 56 | ||||
-rw-r--r-- | chrome/app/breakpad_mac_stubs.mm | 21 |
3 files changed, 25 insertions, 78 deletions
diff --git a/chrome/app/breakpad_mac.h b/chrome/app/breakpad_mac.h index b5eb9e0..b737f0d 100644 --- a/chrome/app/breakpad_mac.h +++ b/chrome/app/breakpad_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -22,28 +22,4 @@ bool IsCrashReporterEnabled(); // Call on clean process shutdown. void DestructCrashReporter(); -#ifdef __OBJC__ - -#include "base/memory/scoped_nsobject.h" - -@class NSString; - -// Set and clear meta information for Minidump. -// IMPORTANT: On OS X, the key/value pairs are sent to the crash server -// out of bounds and not recorded on disk in the minidump, this means -// that if you look at the minidump file locally you won't see them! -void SetCrashKeyValue(NSString* key, NSString* value); -void ClearCrashKeyValue(NSString* key); - -class ScopedCrashKey { - public: - ScopedCrashKey(NSString* key, NSString* value); - ~ScopedCrashKey(); - - private: - scoped_nsobject<NSString> crash_key_; -}; - -#endif // __OBJC__ - #endif // CHROME_APP_BREAKPAD_MAC_H_ diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm index 840ac47..4f4d11c 100644 --- a/chrome/app/breakpad_mac.mm +++ b/chrome/app/breakpad_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -30,6 +30,26 @@ namespace { BreakpadRef gBreakpadRef = NULL; +void SetCrashKeyValue(NSString* key, NSString* value) { + // Comment repeated from header to prevent confusion: + // IMPORTANT: On OS X, the key/value pairs are sent to the crash server + // out of bounds and not recorded on disk in the minidump, this means + // that if you look at the minidump file locally you won't see them! + if (gBreakpadRef == NULL) { + return; + } + + BreakpadAddUploadParameter(gBreakpadRef, key, value); +} + +void ClearCrashKeyValue(NSString* key) { + if (gBreakpadRef == NULL) { + return; + } + + BreakpadRemoveUploadParameter(gBreakpadRef, key); +} + } // namespace bool IsCrashReporterEnabled() { @@ -155,8 +175,8 @@ void InitCrashReporter() { // Enable child process crashes to include the page URL. // TODO: Should this only be done for certain process types? - child_process_logging::SetCrashKeyFunctions(SetCrashKeyValue, - ClearCrashKeyValue); + base::mac::SetCrashKeyFunctions(SetCrashKeyValue, + ClearCrashKeyValue); if (!is_browser) { // Get the guid from the command line switch. @@ -183,33 +203,3 @@ void InitCrashProcessInfo() { // Store process type in crash dump. SetCrashKeyValue(@"ptype", process_type); } - -void SetCrashKeyValue(NSString* key, NSString* value) { - // Comment repeated from header to prevent confusion: - // IMPORTANT: On OS X, the key/value pairs are sent to the crash server - // out of bounds and not recorded on disk in the minidump, this means - // that if you look at the minidump file locally you won't see them! - if (gBreakpadRef == NULL) { - return; - } - - BreakpadAddUploadParameter(gBreakpadRef, key, value); -} - -void ClearCrashKeyValue(NSString* key) { - if (gBreakpadRef == NULL) { - return; - } - - BreakpadRemoveUploadParameter(gBreakpadRef, key); -} - -// NOTE(shess): These also exist in breakpad_mac_stubs.mm. -ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) - : crash_key_([key retain]) { - SetCrashKeyValue(crash_key_.get(), value); -} - -ScopedCrashKey::~ScopedCrashKey() { - ClearCrashKeyValue(crash_key_.get()); -} diff --git a/chrome/app/breakpad_mac_stubs.mm b/chrome/app/breakpad_mac_stubs.mm index b07ded6..db2db6b 100644 --- a/chrome/app/breakpad_mac_stubs.mm +++ b/chrome/app/breakpad_mac_stubs.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -21,22 +21,3 @@ void DestructCrashReporter() { void InitCrashReporter() { } - -void SetCrashKeyValue(NSString* key, NSString* value) { -} - -void ClearCrashKeyValue(NSString* key) { -} - -// NOTE(shess): These functions could clearly be replaced by stubs, -// but since they are seldom-used helpers, it seemed more reasonable -// to duplicate them from the primary implementation in -// breakpad_mac.mm. -ScopedCrashKey::ScopedCrashKey(NSString* key, NSString* value) - : crash_key_([key retain]) { - SetCrashKeyValue(crash_key_.get(), value); -} - -ScopedCrashKey::~ScopedCrashKey() { - ClearCrashKeyValue(crash_key_.get()); -} |