aboutsummaryrefslogtreecommitdiff
path: root/src/client/ios/BreakpadController.mm
diff options
context:
space:
mode:
authorOlivier Robin <olivierrobin@chromium.org>2019-04-18 18:06:31 +0200
committerMark Mentovai <mark@chromium.org>2019-04-23 13:07:06 +0000
commit1fc9cc0d0e1dfafb8d29dba8d01f09587d870026 (patch)
treead334e68729ce88aec5d750f9be3cd21f838d745 /src/client/ios/BreakpadController.mm
parentMake breakpad_unittests work with Chrome's test runner instead of gtest's (diff)
downloadbreakpad-1fc9cc0d0e1dfafb8d29dba8d01f09587d870026.tar.xz
[Breakpad iOS] Add a callback on report upload completion.
This CL adds a result callback on report upload completion. On failure, Breakpad deletes the configuration file and does retry to upload a report. Using this callback, the client will be able to log some metrics and to act on upload failure. Bug: 954175 Change-Id: I95a3264b65d4c06ba5d8dde8377440d23f1e2081 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1572661 Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/client/ios/BreakpadController.mm')
-rw-r--r--src/client/ios/BreakpadController.mm23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/client/ios/BreakpadController.mm b/src/client/ios/BreakpadController.mm
index 8d499c27..01fb5f13 100644
--- a/src/client/ios/BreakpadController.mm
+++ b/src/client/ios/BreakpadController.mm
@@ -166,9 +166,9 @@ NSString* GetPlatform() {
NSAssert(started_, @"The controller must be started before "
"threadUnsafeSendReportWithConfiguration is called");
if (breakpadRef_) {
- BreakpadUploadReportWithParametersAndConfiguration(breakpadRef_,
- uploadTimeParameters_,
- configuration);
+ BreakpadUploadReportWithParametersAndConfiguration(
+ breakpadRef_, uploadTimeParameters_, configuration,
+ uploadCompleteCallback_);
}
}
@@ -195,7 +195,7 @@ NSString* GetPlatform() {
NSAssert(!started_,
@"The controller must not be started when updateConfiguration is called");
[configuration_ addEntriesFromDictionary:configuration];
- NSString* uploadInterval =
+ NSString *uploadInterval =
[configuration_ valueForKey:@BREAKPAD_REPORT_INTERVAL];
if (uploadInterval)
[self setUploadInterval:[uploadInterval intValue]];
@@ -206,7 +206,7 @@ NSString* GetPlatform() {
@"The controller must not be started when resetConfiguration is called");
[configuration_ autorelease];
configuration_ = [[[NSBundle mainBundle] infoDictionary] mutableCopy];
- NSString* uploadInterval =
+ NSString *uploadInterval =
[configuration_ valueForKey:@BREAKPAD_REPORT_INTERVAL];
[self setUploadInterval:[uploadInterval intValue]];
[self setParametersToAddAtUploadTime:nil];
@@ -243,6 +243,15 @@ NSString* GetPlatform() {
});
}
+- (void)setUploadCallback:(BreakpadUploadCompletionCallback)callback {
+ NSAssert(started_,
+ @"The controller must not be started before setUploadCallback is "
+ "called");
+ dispatch_async(queue_, ^{
+ uploadCompleteCallback_ = callback;
+ });
+}
+
- (void)removeUploadParameterForKey:(NSString*)key {
NSAssert(started_, @"The controller must be started before "
"removeUploadParameterForKey is called");
@@ -345,8 +354,8 @@ NSString* GetPlatform() {
// A report can be sent now.
if (timeToWait == 0) {
[self reportWillBeSent];
- BreakpadUploadNextReportWithParameters(breakpadRef_,
- uploadTimeParameters_);
+ BreakpadUploadNextReportWithParameters(breakpadRef_, uploadTimeParameters_,
+ uploadCompleteCallback_);
// If more reports must be sent, make sure this method is called again.
if (BreakpadGetCrashReportCount(breakpadRef_) > 0)