Chromium Code Reviews| Index: ios/chrome/app/safe_mode_crashing_modules_config.mm |
| diff --git a/ios/chrome/app/safe_mode_crashing_modules_config.mm b/ios/chrome/app/safe_mode_crashing_modules_config.mm |
| index b0496cfb7a69c545d6f47f9b37c7a32086a6130a..9106d65af63356861229a1d3c0a0ae0a1569bfa7 100644 |
| --- a/ios/chrome/app/safe_mode_crashing_modules_config.mm |
| +++ b/ios/chrome/app/safe_mode_crashing_modules_config.mm |
| @@ -5,6 +5,8 @@ |
| #import "ios/chrome/app/safe_mode_crashing_modules_config.h" |
| #include "base/logging.h" |
| +#include "base/mac/foundation_util.h" |
| +#import "base/mac/scoped_nsobject.h" |
| namespace { |
| @@ -13,6 +15,11 @@ NSString* const kModuleFriendlyNameKey = @"ModuleFriendlyName"; |
| } // namespace |
| +@interface SafeModeCrashingModulesConfig () { |
| + base::scoped_nsobject<NSDictionary> _configuration; |
| +} |
| +@end |
| + |
| @implementation SafeModeCrashingModulesConfig |
| + (SafeModeCrashingModulesConfig*)sharedInstance { |
| @@ -22,25 +29,23 @@ NSString* const kModuleFriendlyNameKey = @"ModuleFriendlyName"; |
| } |
| - (instancetype)init { |
| - self = [super initWithAppId:nil version:nil plist:@"CrashingModules.plist"]; |
| + self = [super init]; |
| if (self) { |
| - self.stopsUpdateChecksOnAppTermination = YES; |
| + NSString* configPath = |
| + [[NSBundle mainBundle] pathForResource:@"CrashingModules" |
| + ofType:@"plist"]; |
| + _configuration.reset( |
| + [[NSDictionary alloc] initWithContentsOfFile:configPath]); |
| } |
| return self; |
| } |
| - (NSString*)startupCrashModuleFriendlyName:(NSString*)modulePath { |
| - NSDictionary* configData = [self dictionaryFromConfig]; |
| - NSDictionary* modules = [configData objectForKey:kStartupCrashModulesKey]; |
| - if (modules) { |
| - DCHECK([modules isKindOfClass:[NSDictionary class]]); |
| - NSDictionary* module = modules[modulePath]; |
| - if (module) { |
| - DCHECK([module isKindOfClass:[NSDictionary class]]); |
| - return module[kModuleFriendlyNameKey]; |
| - } |
| - } |
| - return nil; |
| + NSDictionary* modules = base::mac::ObjCCastStrict<NSDictionary>( |
|
rohitrao (ping after 24h)
2016/07/15 17:23:19
Does this method also get called during startup?
pkl (ping after 24h if needed)
2016/07/15 20:33:18
This method is currently called from Safe Mode Vie
|
| + [_configuration objectForKey:kStartupCrashModulesKey]); |
| + NSDictionary* module = |
| + base::mac::ObjCCastStrict<NSDictionary>(modules[modulePath]); |
| + return base::mac::ObjCCast<NSString>(module[kModuleFriendlyNameKey]); |
| } |
| @end |