mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 08:15:41 +01:00
Add -[BreakpadController setParametersToAddAtUploadTime:] for iOS.
This provides the ability to add server parameters to a crash report when the report is uploaded. Patch by KiYun Roe <kiyun@chromium.org> BUG=558 R=blundell@chromium.org Review URL: https://breakpad.appspot.com/974002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1271 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
3ea04ec479
commit
12528d19bd
@ -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.
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user