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

Unified Diff: ios/chrome/common/physical_web/physical_web_request.mm

Issue 2512613005: [ObjC ARC] Converts ios/chrome/common/physical_web:physical_web to ARC.Automatically generated AR… (Closed)
Patch Set: Created 4 years, 1 month 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
Index: ios/chrome/common/physical_web/physical_web_request.mm
diff --git a/ios/chrome/common/physical_web/physical_web_request.mm b/ios/chrome/common/physical_web/physical_web_request.mm
index a3ff96834a3ce9b73dfb8292a467315f1f126181..18c43f306791a18d3080891e0dc17ec0c0cdc035 100644
--- a/ios/chrome/common/physical_web/physical_web_request.mm
+++ b/ios/chrome/common/physical_web/physical_web_request.mm
@@ -17,6 +17,10 @@
#import "ios/chrome/common/physical_web/physical_web_types.h"
#include "ios/web/public/user_agent.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
typedef void (^SessionCompletionProceduralBlock)(NSData* data,
NSURLResponse* response,
NSError* error);
@@ -63,7 +67,7 @@ std::string GetUserAgent() {
- (instancetype)initWithDevice:(PhysicalWebDevice*)device {
self = [super init];
if (self) {
- device_.reset([device retain]);
+ device_.reset(device);
}
return self;
}
@@ -95,7 +99,7 @@ std::string GetUserAgent() {
setQueryItems:@[ [NSURLQueryItem queryItemWithName:kKeyQueryItemName
value:apiKey] ]];
NSURL* url = [components URL];
- request_.reset([[NSMutableURLRequest requestWithURL:url] retain]);
+ request_.reset([NSMutableURLRequest requestWithURL:url]);
[request_ setHTTPMethod:kHTTPPOSTRequestMethod];
// body of the POST request.
@@ -116,7 +120,7 @@ std::string GetUserAgent() {
[[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode];
[request_ setValue:acceptLanguage forHTTPHeaderField:@"Acccept-Language"];
- startDate_.reset([[NSDate date] retain]);
+ startDate_.reset([NSDate date]);
// Starts the request.
NSURLSessionConfiguration* sessionConfiguration =
[NSURLSessionConfiguration ephemeralSessionConfiguration];
@@ -128,7 +132,7 @@ std::string GetUserAgent() {
base::WeakNSObject<PhysicalWebRequest> weakSelf(self);
SessionCompletionProceduralBlock completionHandler =
^(NSData* data, NSURLResponse* response, NSError* error) {
- base::scoped_nsobject<PhysicalWebRequest> strongSelf([weakSelf retain]);
+ base::scoped_nsobject<PhysicalWebRequest> strongSelf(weakSelf);
if (!strongSelf) {
return;
}
@@ -139,9 +143,8 @@ std::string GetUserAgent() {
[strongSelf sessionDidFinishLoading];
}
};
- urlSessionTask_.reset([
- [session dataTaskWithRequest:request_ completionHandler:completionHandler]
- retain]);
+ urlSessionTask_.reset([session dataTaskWithRequest:request_
+ completionHandler:completionHandler]);
[urlSessionTask_ resume];
}
« no previous file with comments | « ios/chrome/common/physical_web/physical_web_device.mm ('k') | ios/chrome/common/physical_web/physical_web_scanner.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698