diff options
Diffstat (limited to 'src/client/ios/Breakpad.mm')
-rw-r--r-- | src/client/ios/Breakpad.mm | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm index ee36a04e..88dd2870 100644 --- a/src/client/ios/Breakpad.mm +++ b/src/client/ios/Breakpad.mm @@ -38,15 +38,13 @@ #include <sys/sysctl.h> #include <TargetConditionals.h> -#include <string> - #import "client/ios/handler/ios_exception_minidump_generator.h" #import "client/mac/crash_generation/ConfigFile.h" #import "client/mac/handler/exception_handler.h" #import "client/mac/handler/minidump_generator.h" -#import "client/mac/handler/protected_memory_allocator.h" #import "client/mac/sender/uploader.h" -#import "common/long_string_dictionary.h" +#import "client/mac/handler/protected_memory_allocator.h" +#import "common/simple_string_dictionary.h" #if !TARGET_OS_TV && !TARGET_OS_WATCH #import "client/mac/handler/exception_handler.h" @@ -68,7 +66,7 @@ using google_breakpad::ConfigFile; using google_breakpad::EnsureDirectoryPathExists; -using google_breakpad::LongStringDictionary; +using google_breakpad::SimpleStringDictionary; //============================================================================= // We want any memory allocations which are used by breakpad during the @@ -199,7 +197,7 @@ class Breakpad { // MachineExceptions.h, we have to explicitly name the handler. google_breakpad::ExceptionHandler *handler_; // The actual handler (STRONG) - LongStringDictionary *config_params_; // Create parameters (STRONG) + SimpleStringDictionary *config_params_; // Create parameters (STRONG) ConfigFile config_file_; @@ -315,7 +313,7 @@ Breakpad::~Breakpad() { // since they were allocated by ProtectedMemoryAllocator objects. // if (config_params_) { - config_params_->~LongStringDictionary(); + config_params_->~SimpleStringDictionary(); } if (handler_) @@ -383,10 +381,10 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { } config_params_ = - new (gKeyValueAllocator->Allocate(sizeof(LongStringDictionary))) - LongStringDictionary(); + new (gKeyValueAllocator->Allocate(sizeof(SimpleStringDictionary)) ) + SimpleStringDictionary(); - LongStringDictionary &dictionary = *config_params_; + SimpleStringDictionary &dictionary = *config_params_; dictionary.SetKeyValue(BREAKPAD_SERVER_TYPE, [serverType UTF8String]); dictionary.SetKeyValue(BREAKPAD_PRODUCT_DISPLAY, [display UTF8String]); @@ -429,8 +427,8 @@ NSString *Breakpad::KeyValue(NSString *key) { if (!config_params_ || !key) return nil; - const std::string value = config_params_->GetValueForKey([key UTF8String]); - return value.empty() ? nil : [NSString stringWithUTF8String:value.c_str()]; + const char *value = config_params_->GetValueForKey([key UTF8String]); + return value ? [NSString stringWithUTF8String:value] : nil; } //============================================================================= @@ -504,8 +502,8 @@ void Breakpad::UploadData(NSData *data, NSString *name, NSDictionary *server_parameters) { NSMutableDictionary *config = [NSMutableDictionary dictionary]; - LongStringDictionary::Iterator it(*config_params_); - while (const LongStringDictionary::Entry *next = it.Next()) { + SimpleStringDictionary::Iterator it(*config_params_); + while (const SimpleStringDictionary::Entry *next = it.Next()) { [config setValue:[NSString stringWithUTF8String:next->value] forKey:[NSString stringWithUTF8String:next->key]]; } @@ -534,7 +532,7 @@ NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) { if (!success) return nil; - LongStringDictionary params = *config_params_; + SimpleStringDictionary params = *config_params_; for (NSString *key in server_parameters) { params.SetKeyValue([key UTF8String], [[server_parameters objectForKey:key] UTF8String]); @@ -569,7 +567,7 @@ bool Breakpad::HandleMinidump(const char *dump_dir, void Breakpad::HandleUncaughtException(NSException *exception) { // Generate the minidump. google_breakpad::IosExceptionMinidumpGenerator generator(exception); - const std::string minidump_path = + const char *minidump_path = config_params_->GetValueForKey(BREAKPAD_DUMP_DIRECTORY); std::string minidump_id; std::string minidump_filename = generator.UniqueNameInDirectory(minidump_path, @@ -582,7 +580,7 @@ void Breakpad::HandleUncaughtException(NSException *exception) { // 2- If the application crash while trying to handle this exception, a usual // report will be generated. This report must not contain these special // keys. - LongStringDictionary params = *config_params_; + SimpleStringDictionary params = *config_params_; params.SetKeyValue(BREAKPAD_SERVER_PARAMETER_PREFIX "type", "exception"); params.SetKeyValue(BREAKPAD_SERVER_PARAMETER_PREFIX "exceptionName", [[exception name] UTF8String]); @@ -591,9 +589,9 @@ void Breakpad::HandleUncaughtException(NSException *exception) { // And finally write the config file. ConfigFile config_file; - config_file.WriteFile(minidump_path.c_str(), + config_file.WriteFile(minidump_path, ¶ms, - minidump_path.c_str(), + minidump_path, minidump_id.c_str()); } @@ -621,9 +619,9 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) { gKeyValueAllocator = new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator))) - ProtectedMemoryAllocator(sizeof(LongStringDictionary)); + ProtectedMemoryAllocator(sizeof(SimpleStringDictionary)); - // Create a mutex for use in accessing the LongStringDictionary + // Create a mutex for use in accessing the SimpleStringDictionary int mutexResult = pthread_mutex_init(&gDictionaryMutex, NULL); if (mutexResult == 0) { |