aboutsummaryrefslogtreecommitdiff
path: root/src/client/ios/Breakpad.mm
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-11-20 16:34:13 +0000
committermark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-11-20 16:34:13 +0000
commit8e28cb38988455cbdd4fcac2c8dc7301baca009a (patch)
treea98b6d980deaf0f3e974e283e14c764e16926510 /src/client/ios/Breakpad.mm
parentAllow SIGABRT to abort the program. (diff)
downloadbreakpad-8e28cb38988455cbdd4fcac2c8dc7301baca009a.tar.xz
Provide BreakpadGetCrashReportCount() and -[BreakpadController
getCrashReportCount:] This provides the ability for clients to query the number of crash reports that are waiting to upload. Patch by KiYun Roe <kiyun@chromium.org> BUG=547 Review URL: https://breakpad.appspot.com/714002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1234 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/ios/Breakpad.mm')
-rw-r--r--src/client/ios/Breakpad.mm19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm
index 0b74e323..44a61ff4 100644
--- a/src/client/ios/Breakpad.mm
+++ b/src/client/ios/Breakpad.mm
@@ -162,6 +162,7 @@ class Breakpad {
void SetKeyValue(NSString *key, NSString *value);
NSString *KeyValue(NSString *key);
void RemoveKeyValue(NSString *key);
+ NSArray *CrashReportsToUpload();
NSString *NextCrashReportToUpload();
void UploadNextReport();
void UploadData(NSData *data, NSString *name,
@@ -440,7 +441,7 @@ void Breakpad::RemoveKeyValue(NSString *key) {
}
//=============================================================================
-NSString *Breakpad::NextCrashReportToUpload() {
+NSArray *Breakpad::CrashReportsToUpload() {
NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY);
if (!directory)
return nil;
@@ -448,7 +449,15 @@ NSString *Breakpad::NextCrashReportToUpload() {
contentsOfDirectoryAtPath:directory error:nil];
NSArray *configs = [dirContents filteredArrayUsingPredicate:[NSPredicate
predicateWithFormat:@"self BEGINSWITH 'Config-'"]];
- NSString *config = [configs lastObject];
+ return configs;
+}
+
+//=============================================================================
+NSString *Breakpad::NextCrashReportToUpload() {
+ NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY);
+ if (!directory)
+ return nil;
+ NSString *config = [CrashReportsToUpload() lastObject];
if (!config)
return nil;
return [NSString stringWithFormat:@"%@/%@", directory, config];
@@ -779,16 +788,16 @@ void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key) {
}
//=============================================================================
-bool BreakpadHasCrashReportToUpload(BreakpadRef ref) {
+int BreakpadGetCrashReportCount(BreakpadRef ref) {
try {
// Not called at exception time
Breakpad *breakpad = (Breakpad *)ref;
if (breakpad) {
- return breakpad->NextCrashReportToUpload() != 0;
+ return [breakpad->CrashReportsToUpload() count];
}
} catch(...) { // don't let exceptions leave this C API
- fprintf(stderr, "BreakpadHasCrashReportToUpload() : error\n");
+ fprintf(stderr, "BreakpadGetCrashReportCount() : error\n");
}
return false;
}