aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/ios/Breakpad.h4
-rw-r--r--src/client/ios/Breakpad.mm16
-rw-r--r--src/client/ios/BreakpadController.h11
-rw-r--r--src/client/ios/BreakpadController.mm11
4 files changed, 33 insertions, 9 deletions
diff --git a/src/client/ios/Breakpad.h b/src/client/ios/Breakpad.h
index 3bec1a63..c3362b0f 100644
--- a/src/client/ios/Breakpad.h
+++ b/src/client/ios/Breakpad.h
@@ -200,7 +200,9 @@ void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key);
int BreakpadGetCrashReportCount(BreakpadRef ref);
// Upload next report to the server.
-void BreakpadUploadNextReport(BreakpadRef ref);
+// |server_parameters| is additional server parameters to send (optional).
+void BreakpadUploadNextReport(BreakpadRef ref,
+ NSDictionary *server_parameters = nil);
// Upload a file to the server. |data| is the content of the file to sent.
// |server_parameters| is additional server parameters to send.
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm
index 3b9f6d3f..2bd7e33b 100644
--- a/src/client/ios/Breakpad.mm
+++ b/src/client/ios/Breakpad.mm
@@ -152,7 +152,7 @@ class Breakpad {
void RemoveKeyValue(NSString *key);
NSArray *CrashReportsToUpload();
NSString *NextCrashReportToUpload();
- void UploadNextReport();
+ void UploadNextReport(NSDictionary *server_parameters);
void UploadData(NSData *data, NSString *name,
NSDictionary *server_parameters);
NSDictionary *GenerateReport(NSDictionary *server_parameters);
@@ -448,13 +448,18 @@ NSString *Breakpad::NextCrashReportToUpload() {
}
//=============================================================================
-void Breakpad::UploadNextReport() {
+void Breakpad::UploadNextReport(NSDictionary *server_parameters) {
NSString *configFile = NextCrashReportToUpload();
if (configFile) {
Uploader *uploader = [[[Uploader alloc]
initWithConfigFile:[configFile UTF8String]] autorelease];
- if (uploader)
+ if (uploader) {
+ for (NSString *key in server_parameters) {
+ [uploader addServerParameter:[server_parameters objectForKey:key]
+ forKey:key];
+ }
[uploader report];
+ }
}
}
@@ -784,13 +789,14 @@ int BreakpadGetCrashReportCount(BreakpadRef ref) {
}
//=============================================================================
-void BreakpadUploadNextReport(BreakpadRef ref) {
+void BreakpadUploadNextReport(BreakpadRef ref,
+ NSDictionary *server_parameters) {
try {
// Not called at exception time
Breakpad *breakpad = (Breakpad *)ref;
if (breakpad) {
- breakpad->UploadNextReport();
+ breakpad->UploadNextReport(server_parameters);
}
} catch(...) { // don't let exceptions leave this C API
fprintf(stderr, "BreakpadUploadNextReport() : error\n");
diff --git a/src/client/ios/BreakpadController.h b/src/client/ios/BreakpadController.h
index be072ea9..cf1fa774 100644
--- a/src/client/ios/BreakpadController.h
+++ b/src/client/ios/BreakpadController.h
@@ -62,6 +62,10 @@
// The interval to wait between two uploads. Value is 0 if no upload must be
// done.
int uploadIntervalInSeconds_;
+
+ // The dictionary that contains additional server parameters to send when
+ // uploading crash reports.
+ NSDictionary* uploadTimeParameters_;
}
// Singleton.
@@ -84,8 +88,11 @@
// will prevent uploads.
- (void)setUploadInterval:(int)intervalInSeconds;
-// Specify a parameter that will be uploaded to the crash server. See
-// |BreakpadAddUploadParameter|.
+// Set additional server parameters to send when uploading crash reports.
+- (void)setParametersToAddAtUploadTime:(NSDictionary*)uploadTimeParameters;
+
+// Specify an upload parameter that will be added to the crash report when a
+// crash report is generated. See |BreakpadAddUploadParameter|.
- (void)addUploadParameter:(NSString*)value forKey:(NSString*)key;
// Remove a previously-added parameter from the upload parameter set. See
diff --git a/src/client/ios/BreakpadController.mm b/src/client/ios/BreakpadController.mm
index 9a6dd814..4571470d 100644
--- a/src/client/ios/BreakpadController.mm
+++ b/src/client/ios/BreakpadController.mm
@@ -120,6 +120,7 @@ NSString* GetPlatform() {
assert(!breakpadRef_);
dispatch_release(queue_);
[configuration_ release];
+ [uploadTimeParameters_ release];
[super dealloc];
}
@@ -192,6 +193,7 @@ NSString* GetPlatform() {
NSString* uploadInterval =
[configuration_ valueForKey:@BREAKPAD_REPORT_INTERVAL];
[self setUploadInterval:[uploadInterval intValue]];
+ [self setParametersToAddAtUploadTime:nil];
}
- (void)setUploadingURL:(NSString*)url {
@@ -209,6 +211,13 @@ NSString* GetPlatform() {
uploadIntervalInSeconds_ = 0;
}
+- (void)setParametersToAddAtUploadTime:(NSDictionary*)uploadTimeParameters {
+ NSAssert(!started_, @"The controller must not be started when "
+ "setParametersToAddAtUploadTime is called");
+ [uploadTimeParameters_ autorelease];
+ uploadTimeParameters_ = [uploadTimeParameters copy];
+}
+
- (void)addUploadParameter:(NSString*)value forKey:(NSString*)key {
NSAssert(started_,
@"The controller must be started before addUploadParameter is called");
@@ -291,7 +300,7 @@ NSString* GetPlatform() {
// A report can be sent now.
if (timeToWait == 0) {
[self reportWillBeSent];
- BreakpadUploadNextReport(breakpadRef_);
+ BreakpadUploadNextReport(breakpadRef_, uploadTimeParameters_);
// If more reports must be sent, make sure this method is called again.
if (BreakpadGetCrashReportCount(breakpadRef_) > 0)