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

Unified Diff: chrome/app/breakpad_mac.mm

Issue 87014: .gyp file for Breakpad on OS X. (Closed)
Patch Set: Fix John's comments + obj-c side. Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/app/breakpad_mac.mm
diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm
index a301e86f6bb982103467c40f17fe5a4da46a41eb..acd3054c928268f1f33e97b96bb3571b0ce07cc4 100644
--- a/chrome/app/breakpad_mac.mm
+++ b/chrome/app/breakpad_mac.mm
@@ -4,12 +4,12 @@
#import "chrome/app/breakpad_mac.h"
-#import <dlfcn.h>
#import <Foundation/Foundation.h>
#import "base/basictypes.h"
#import "base/logging.h"
#import "base/scoped_nsautorelease_pool.h"
+#import "breakpad/src/client/mac/Framework/Breakpad.h"
// For definition of SetActiveRendererURL().
#import "chrome/renderer/renderer_logging.h"
@@ -20,22 +20,8 @@
namespace {
-// TODO(jeremy): Remove this block once we include the breakpad sources
-// in the public tree.
-typedef void* GoogleBreakpadRef;
-typedef void (*GoogleBreakpadSetKeyValuePtr) (GoogleBreakpadRef, NSString*,
- NSString*);
-typedef void (*GoogleBreakpadRemoveKeyValuePtr) (GoogleBreakpadRef, NSString*);
-typedef GoogleBreakpadRef (*GoogleBreakPadCreatePtr) (NSDictionary*);
-typedef void (*GoogleBreakPadReleasePtr) (GoogleBreakpadRef);
-
-
-GoogleBreakpadRef gBreakpadRef = NULL;
-GoogleBreakPadCreatePtr gBreakPadCreateFunc = NULL;
-GoogleBreakPadReleasePtr gBreakPadReleaseFunc = NULL;
-GoogleBreakpadSetKeyValuePtr gBreakpadSetKeyValueFunc = NULL;
-GoogleBreakpadRemoveKeyValuePtr gBreakpadRemoveKeyValueFunc = NULL;
+BreakpadRef gBreakpadRef = NULL;
// Did the user optin for reporting stats.
bool IsStatsReportingAllowed() {
@@ -51,8 +37,7 @@ bool IsCrashReporterEnabled() {
void DestructCrashReporter() {
if (gBreakpadRef) {
- DCHECK(gBreakPadReleaseFunc != NULL);
- gBreakPadReleaseFunc(gBreakpadRef);
+ BreakpadRelease(gBreakpadRef);
gBreakpadRef = NULL;
}
}
@@ -70,42 +55,9 @@ void InitCrashReporter() {
NSBundle* main_bundle = [NSBundle mainBundle];
- // Get location of breakpad.
- NSString* breakpadBundlePath = [[main_bundle privateFrameworksPath]
- stringByAppendingPathComponent:@"GoogleBreakpad.framework"];
-
- BOOL is_dir = NO;
- if (![[NSFileManager defaultManager] fileExistsAtPath:breakpadBundlePath
- isDirectory:&is_dir] || !is_dir) {
- return;
- }
-
- NSBundle* breakpad_bundle = [NSBundle bundleWithPath:breakpadBundlePath];
- if (![breakpad_bundle load]) {
- LOG(ERROR) << "Failed to load Breakpad framework.";
- return;
- }
-
- // Retrieve Breakpad interface functions.
- gBreakPadCreateFunc = reinterpret_cast<GoogleBreakPadCreatePtr>(
- dlsym(RTLD_DEFAULT, "GoogleBreakpadCreate"));
- gBreakPadReleaseFunc = reinterpret_cast<GoogleBreakPadReleasePtr>(
- dlsym(RTLD_DEFAULT, "GoogleBreakpadRelease"));
- gBreakpadSetKeyValueFunc = reinterpret_cast<GoogleBreakpadSetKeyValuePtr>(
- dlsym(RTLD_DEFAULT, "GoogleBreakpadSetKeyValue"));
- gBreakpadRemoveKeyValueFunc =
- reinterpret_cast<GoogleBreakpadRemoveKeyValuePtr>(
- dlsym(RTLD_DEFAULT, "GoogleBreakpadRemoveKeyValue"));
-
- if (!gBreakPadCreateFunc || !gBreakPadReleaseFunc
- || !gBreakpadSetKeyValueFunc || !gBreakpadRemoveKeyValueFunc) {
- LOG(ERROR) << "Failed to find Breakpad wrapper classes.";
- return;
- }
-
NSDictionary* info_dictionary = [main_bundle infoDictionary];
- GoogleBreakpadRef breakpad = NULL;
- breakpad = gBreakPadCreateFunc(info_dictionary);
+ BreakpadRef breakpad = NULL;
+ breakpad = BreakpadCreate(info_dictionary);
if (!breakpad) {
LOG(ERROR) << "Breakpad init failed.";
return;
@@ -137,8 +89,7 @@ void SetCrashKeyValue(NSString* key, NSString* value) {
return;
}
- DCHECK(gBreakpadSetKeyValueFunc != NULL);
- gBreakpadSetKeyValueFunc(gBreakpadRef, key, value);
+ BreakpadSetKeyValue(gBreakpadRef, key, value);
}
void ClearCrashKeyValue(NSString* key) {
@@ -146,6 +97,5 @@ void ClearCrashKeyValue(NSString* key) {
return;
}
- DCHECK(gBreakpadRemoveKeyValueFunc != NULL);
- gBreakpadRemoveKeyValueFunc(gBreakpadRef, key);
+ BreakpadRemoveKeyValue(gBreakpadRef, key);
}

Powered by Google App Engine
This is Rietveld 408576698