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

Unified Diff: ios/web/net/clients/crw_redirect_network_client.mm

Issue 2247303009: Converts ios/web/net to ARC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ios-web
Patch Set: Removes web_arc_transition temporary target Created 4 years, 4 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
Index: ios/web/net/clients/crw_redirect_network_client.mm
diff --git a/ios/web/net/clients/crw_redirect_network_client.mm b/ios/web/net/clients/crw_redirect_network_client.mm
index df4bba0add2030aa25ee1374ac6c16bd45ce9aeb..5f86de3813b80f8af81fab7310c63735a86be4f0 100644
--- a/ios/web/net/clients/crw_redirect_network_client.mm
+++ b/ios/web/net/clients/crw_redirect_network_client.mm
@@ -8,24 +8,23 @@
#include "base/mac/bind_objc_block.h"
#include "ios/web/public/web_thread.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
@interface CRWRedirectNetworkClient () {
// The delegate.
- base::WeakNSProtocol<id<CRWRedirectClientDelegate>> delegate_;
+ __weak id<CRWRedirectClientDelegate> _delegate;
}
@end
@implementation CRWRedirectNetworkClient
-- (instancetype)initWithDelegate:
- (base::WeakNSProtocol<id<CRWRedirectClientDelegate>>)delegate {
+- (instancetype)initWithDelegate:(id<CRWRedirectClientDelegate>)delegate {
self = [super init];
if (self) {
- // CRWRedirectNetworkClients are created on the IO thread, but due to the
- // threading restrictions of WeakNSObjects, |delegate_| may only be
- // dereferenced on the UI thread.
- DCHECK_CURRENTLY_ON(web::WebThread::IO);
- delegate_ = delegate;
+ _delegate = delegate;
}
return self;
}
@@ -40,10 +39,10 @@
redirectResponse:(NSURLResponse*)redirectResponse {
DCHECK_CURRENTLY_ON(web::WebThread::IO);
web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, base::BindBlock(^{
- // |delegate_| can only be dereferenced from the UI thread.
- [delegate_ wasRedirectedToRequest:request
- redirectResponse:redirectResponse];
- }));
+ [_delegate
+ wasRedirectedToRequest:request
+ redirectResponse:redirectResponse];
+ }));
[super wasRedirectedToRequest:request
nativeRequest:nativeRequest
redirectResponse:redirectResponse];

Powered by Google App Engine
This is Rietveld 408576698