From e438d9cc0bffdd03ebe096e6a0df898beed5135a Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 22 Apr 2009 13:22:08 +0000 Subject: Add a parameter to control the Mac reporter timeout. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@332 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/mac/Framework/Breakpad.h | 7 +++++++ src/client/mac/Framework/Breakpad.mm | 5 +++++ src/client/mac/sender/crash_report_sender.m | 23 ++++++++++++----------- 3 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src/client/mac') diff --git a/src/client/mac/Framework/Breakpad.h b/src/client/mac/Framework/Breakpad.h index 4b5357d2..483b8769 100644 --- a/src/client/mac/Framework/Breakpad.h +++ b/src/client/mac/Framework/Breakpad.h @@ -68,6 +68,7 @@ extern "C" { #define BREAKPAD_URL "BreakpadURL" #define BREAKPAD_REPORT_INTERVAL "BreakpadReportInterval" #define BREAKPAD_SKIP_CONFIRM "BreakpadSkipConfirm" +#define BREAKPAD_CONFIRM_TIMEOUT "BreakpadConfirmTimeout" #define BREAKPAD_SEND_AND_EXIT "BreakpadSendAndExit" #define BREAKPAD_DUMP_DIRECTORY "BreakpadMinidumpLocation" #define BREAKPAD_INSPECTOR_LOCATION "BreakpadInspectorLocation" @@ -134,6 +135,12 @@ typedef bool (*BreakpadFilterCallback)(int exception_type, // without any user intervention. // Defaults to NO // +// BREAKPAD_CONFIRM_TIMEOUT Number of seconds before the upload +// confirmation dialog will be automatically +// dismissed (cancelling the upload). +// Default: 300 seconds (min of 60). +// Specify 0 to prevent timeout. +// // BREAKPAD_SEND_AND_EXIT If true, the handler will exit after sending. // This will prevent any other handler (e.g., // CrashReporter) from getting the crash. diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm index 30b8eeab..22785c3c 100644 --- a/src/client/mac/Framework/Breakpad.mm +++ b/src/client/mac/Framework/Breakpad.mm @@ -398,6 +398,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { NSString *reporterPathString = [parameters objectForKey:@BREAKPAD_REPORTER_EXE_LOCATION]; NSString *skipConfirm = [parameters objectForKey:@BREAKPAD_SKIP_CONFIRM]; + NSString *timeout = [parameters objectForKey:@BREAKPAD_CONFIRM_TIMEOUT]; NSString *sendAndExit = [parameters objectForKey:@BREAKPAD_SEND_AND_EXIT]; NSArray *logFilePaths = [parameters objectForKey:@BREAKPAD_LOGFILES]; NSString *logFileTailSize = [parameters objectForKey:@BREAKPAD_LOGFILE_UPLOAD_SIZE]; @@ -432,6 +433,9 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { if (!interval) interval = @"3600"; + if (!timeout) + timeout = @"300"; + if (!logFileTailSize) logFileTailSize = @"200000"; @@ -535,6 +539,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { dictionary.SetKeyValue(BREAKPAD_URL, [urlStr UTF8String]); dictionary.SetKeyValue(BREAKPAD_REPORT_INTERVAL, [interval UTF8String]); dictionary.SetKeyValue(BREAKPAD_SKIP_CONFIRM, [skipConfirm UTF8String]); + dictionary.SetKeyValue(BREAKPAD_CONFIRM_TIMEOUT, [timeout UTF8String]); dictionary.SetKeyValue(BREAKPAD_INSPECTOR_LOCATION, [inspectorPathString fileSystemRepresentation]); dictionary.SetKeyValue(BREAKPAD_REPORTER_EXE_LOCATION, diff --git a/src/client/mac/sender/crash_report_sender.m b/src/client/mac/sender/crash_report_sender.m index 61564e54..03fc05c2 100644 --- a/src/client/mac/sender/crash_report_sender.m +++ b/src/client/mac/sender/crash_report_sender.m @@ -369,7 +369,6 @@ NSString *const kDefaultServerType = @"google"; @""), display]]; NSString *defaultButtonTitle = nil; NSString *otherButtonTitle = nil; - NSTimeInterval timeout = 60.0; // timeout value for the user notification // Get the localized alert strings // If we're going to submit a report, prompt the user if this is okay. @@ -386,19 +385,19 @@ NSString *const kDefaultServerType = @"google"; nil, bundle, @""); otherButtonTitle = NSLocalizedStringFromTableInBundle(@"cancelButton", nil, bundle, @""); - - // Nominally use the report interval - timeout = [[parameters_ objectForKey:@BREAKPAD_REPORT_INTERVAL] - floatValue]; } else { [self setReportMessage:NSLocalizedStringFromTableInBundle(@"noSendMsg", nil, bundle, @"")]; defaultButtonTitle = NSLocalizedStringFromTableInBundle(@"noSendButton", nil, bundle, @""); - timeout = 60.0; } - // show the notification for at least one minute - if (timeout < 60.0) { + + // Get the timeout value for the notification. + NSTimeInterval timeout = [[parameters_ objectForKey:@BREAKPAD_CONFIRM_TIMEOUT] + floatValue]; + // Show the notification for at least one minute (but allow 0, since it means + // no timeout). + if (timeout > 0.001 && timeout < 60.0) { timeout = 60.0; } @@ -452,9 +451,11 @@ NSString *const kDefaultServerType = @"google"; - (int)runModalWindow:(NSWindow*)window withTimeout:(NSTimeInterval)timeout { // Queue a |stopModal| message to be performed in |timeout| seconds. - [NSApp performSelector:@selector(stopModal) - withObject:nil - afterDelay:timeout]; + if (timeout > 0.001) { + [NSApp performSelector:@selector(stopModal) + withObject:nil + afterDelay:timeout]; + } // Run the window modally and wait for either a |stopModal| message or a // button click. -- cgit v1.2.1