Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: ios/chrome/browser/crash_report/crash_report_helper.mm

Issue 2916253003: [ObjC ARC] Converts ios/chrome/browser/crash_report:crash_report_internal to ARC. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/crash_report/BUILD.gn ('k') | ios/chrome/browser/crash_report/crash_restore_helper.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/crash_report/crash_report_helper.mm
diff --git a/ios/chrome/browser/crash_report/crash_report_helper.mm b/ios/chrome/browser/crash_report/crash_report_helper.mm
index bbb5fcbb04f76a515dfd7230241a0d0349fc5089..827220511dd5a88e6ddfb3386765b6fb2de5a26e 100644
--- a/ios/chrome/browser/crash_report/crash_report_helper.mm
+++ b/ios/chrome/browser/crash_report/crash_report_helper.mm
@@ -13,7 +13,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
-#include "base/mac/scoped_nsobject.h"
#include "base/path_service.h"
#include "base/strings/sys_string_conversions.h"
#include "base/time/time.h"
@@ -30,15 +29,19 @@
#include "ios/web/public/web_thread.h"
#import "net/base/mac/url_conversions.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
// TabModelObserver that allows loaded urls to be sent to the crash server.
@interface CrashReporterURLObserver : NSObject<TabModelObserver> {
@private
// Map associating the tab id to the breakpad key used to keep track of the
// loaded URL.
- base::scoped_nsobject<NSMutableDictionary> breakpadKeyByTabId_;
+ NSMutableDictionary* breakpadKeyByTabId_;
// List of keys to use for recording URLs. This list is sorted such that a new
// tab must use the first key in this list to record its URLs.
- base::scoped_nsobject<NSMutableArray> breakpadKeys_;
+ NSMutableArray* breakpadKeys_;
}
+ (CrashReporterURLObserver*)uniqueInstance;
// Removes the URL for the tab with the given id from the URLs sent to the crash
@@ -65,7 +68,7 @@
@private
// Map associating the tab id to an object describing the current state of the
// tab.
- base::scoped_nsobject<NSMutableDictionary> tabCurrentStateByTabId_;
+ NSMutableDictionary* tabCurrentStateByTabId_;
}
+ (CrashReporterURLObserver*)uniqueInstance;
// Removes the stats for the tab tabId
@@ -114,10 +117,10 @@ const int kNumberOfURLsToSend = 1;
- (id)init {
if ((self = [super init])) {
- breakpadKeyByTabId_.reset(
- [[NSMutableDictionary alloc] initWithCapacity:kNumberOfURLsToSend]);
- breakpadKeys_.reset(
- [[NSMutableArray alloc] initWithCapacity:kNumberOfURLsToSend]);
+ breakpadKeyByTabId_ =
+ [[NSMutableDictionary alloc] initWithCapacity:kNumberOfURLsToSend];
+ breakpadKeys_ =
+ [[NSMutableArray alloc] initWithCapacity:kNumberOfURLsToSend];
for (int i = 0; i < kNumberOfURLsToSend; ++i)
[breakpadKeys_ addObject:[NSString stringWithFormat:@"url%d", i]];
// Register for url changed notifications.
@@ -159,7 +162,6 @@ const int kNumberOfURLsToSend = 1;
NSString* key = [breakpadKeyByTabId_ objectForKey:tabId];
if (!key)
return;
- base::scoped_nsobject<NSString> alive([key retain]);
breakpad_helper::RemoveReportParameter(key);
breakpad_helper::RemoveReportParameter(PendingURLKeyForKey(key));
[breakpadKeyByTabId_ removeObjectForKey:tabId];
@@ -174,9 +176,7 @@ const int kNumberOfURLsToSend = 1;
BOOL reusingKey = NO;
if (!breakpadKey) {
// Get the first breakpad key and push it back at the end of the keys.
- base::scoped_nsobject<NSString> alive(
- [[breakpadKeys_ objectAtIndex:0] retain]);
- breakpadKey = alive.get();
+ breakpadKey = [breakpadKeys_ objectAtIndex:0];
[breakpadKeys_ removeObject:breakpadKey];
[breakpadKeys_ addObject:breakpadKey];
// Remove the current mapping to the breakpad key.
@@ -242,7 +242,7 @@ const int kNumberOfURLsToSend = 1;
- (id)init {
if ((self = [super init])) {
- tabCurrentStateByTabId_.reset([[NSMutableDictionary alloc] init]);
+ tabCurrentStateByTabId_ = [[NSMutableDictionary alloc] init];
// Register for url changed notifications.
[[NSNotificationCenter defaultCenter]
addObserver:self
@@ -276,9 +276,9 @@ const int kNumberOfURLsToSend = 1;
NSMutableDictionary* tabCurrentState =
[tabCurrentStateByTabId_ objectForKey:tabId];
if (tabCurrentState == nil) {
- base::scoped_nsobject<NSMutableDictionary> currentStateOfNewTab(
- [[NSMutableDictionary alloc] init]);
- [tabCurrentStateByTabId_ setObject:currentStateOfNewTab.get() forKey:tabId];
+ NSMutableDictionary* currentStateOfNewTab =
+ [[NSMutableDictionary alloc] init];
+ [tabCurrentStateByTabId_ setObject:currentStateOfNewTab forKey:tabId];
tabCurrentState = [tabCurrentStateByTabId_ objectForKey:tabId];
}
[tabCurrentState setObject:value forKey:key];
« no previous file with comments | « ios/chrome/browser/crash_report/BUILD.gn ('k') | ios/chrome/browser/crash_report/crash_restore_helper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698