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

Unified Diff: ios/web/web_state/crw_web_view_scroll_view_proxy.mm

Issue 2380323002: [ARC] Converts parts of ios/web/web_state to ARC. (Closed)
Patch Set: Created 4 years, 3 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/web/web_state/crw_web_view_proxy_impl.mm ('k') | ios/web/web_state/error_translation_util.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/crw_web_view_scroll_view_proxy.mm
diff --git a/ios/web/web_state/crw_web_view_scroll_view_proxy.mm b/ios/web/web_state/crw_web_view_scroll_view_proxy.mm
index 306a9caca3071548bd3305daaf1c2ff098638f4b..e22aaaea04cc3a6d30bcf76dc3995b3aa7267d4b 100644
--- a/ios/web/web_state/crw_web_view_scroll_view_proxy.mm
+++ b/ios/web/web_state/crw_web_view_scroll_view_proxy.mm
@@ -4,14 +4,19 @@
#import "ios/web/public/web_state/crw_web_view_scroll_view_proxy.h"
+#import <objc/runtime.h>
marq (ping after 24h) 2016/10/04 12:49:05 Is this needed?
stkhapugin 2016/10/04 13:02:50 Yes, before it was transitevly included from base/
+
#include "base/auto_reset.h"
#import "base/ios/crb_protocol_observers.h"
-#import "base/ios/weak_nsobject.h"
#include "base/mac/foundation_util.h"
#import "base/mac/scoped_nsobject.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
@interface CRWWebViewScrollViewProxy () {
- base::WeakNSObject<UIScrollView> _scrollView;
+ __weak UIScrollView* _scrollView;
base::scoped_nsobject<id> _observers;
marq (ping after 24h) 2016/10/04 12:49:05 Why not convert this to a strong property as well?
stkhapugin 2016/10/04 13:02:50 The plan is to remove scoped_nsobject boilerplate
// When |_ignoreScroll| is set to YES, do not pass on -scrollViewDidScroll
// calls to observers. This is used by -setContentInsetFast, which needs to
@@ -36,15 +41,13 @@
self = [super init];
if (self) {
Protocol* protocol = @protocol(CRWWebViewScrollViewProxyObserver);
- _observers.reset(
- [[CRBProtocolObservers observersWithProtocol:protocol] retain]);
+ _observers.reset([CRBProtocolObservers observersWithProtocol:protocol]);
}
return self;
}
- (void)dealloc {
[self stopObservingScrollView:_scrollView];
- [super dealloc];
}
- (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer {
@@ -71,7 +74,7 @@
DCHECK(!scrollView.delegate);
scrollView.delegate = self;
[self startObservingScrollView:scrollView];
- _scrollView.reset(scrollView);
+ _scrollView = scrollView;
[_observers webViewScrollViewProxyDidSetScrollView:self];
}
@@ -141,9 +144,8 @@
// position, we can ignore these calls.
base::AutoReset<BOOL> autoReset(&_ignoreScroll, YES);
CGPoint contentOffset = [_scrollView contentOffset];
- _scrollView.get().contentOffset =
- CGPointMake(contentOffset.x, contentOffset.y + 1);
- _scrollView.get().contentOffset = contentOffset;
+ _scrollView.contentOffset = CGPointMake(contentOffset.x, contentOffset.y + 1);
+ _scrollView.contentOffset = contentOffset;
}
- (void)setContentInset:(UIEdgeInsets)contentInset {
@@ -264,7 +266,7 @@
ofObject:(id)object
change:(NSDictionary*)change
context:(void*)context {
- DCHECK_EQ(object, _scrollView.get());
+ DCHECK_EQ(object, _scrollView);
if ([keyPath isEqualToString:@"contentSize"])
[_observers webViewScrollViewDidResetContentSize:self];
}
« no previous file with comments | « ios/web/web_state/crw_web_view_proxy_impl.mm ('k') | ios/web/web_state/error_translation_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698