Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/web_view/public/cwv_scroll_view.h" | 5 #import "ios/web_view/public/cwv_scroll_view.h" |
| 6 | 6 |
| 7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" | 7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" |
| 8 #import "ios/web_view/internal/cwv_scroll_view_internal.h" | 8 #import "ios/web_view/internal/cwv_scroll_view_internal.h" |
| 9 #import "ios/web_view/public/cwv_scroll_view_delegate.h" | 9 #import "ios/web_view/public/cwv_scroll_view_delegate.h" |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 } | 59 } |
| 60 | 60 |
| 61 - (UIEdgeInsets)contentInset { | 61 - (UIEdgeInsets)contentInset { |
| 62 return _proxy.contentInset; | 62 return _proxy.contentInset; |
| 63 } | 63 } |
| 64 | 64 |
| 65 - (void)setContentInset:(UIEdgeInsets)contentInset { | 65 - (void)setContentInset:(UIEdgeInsets)contentInset { |
| 66 _proxy.contentInset = contentInset; | 66 _proxy.contentInset = contentInset; |
| 67 } | 67 } |
| 68 | 68 |
| 69 #pragma mark - NSObject | |
| 70 | |
| 71 - (void)dealloc { | |
| 72 // Explicitly set |proxy| to nil to remove |self| from |proxy|'s observers. | |
| 73 // Otherwise |proxy| will keep a dangling pointer to |self| and cause SEGV. | |
| 74 self.proxy = nil; | |
|
Eugene But (OOO till 7-30)
2017/04/28 07:06:23
_proxy = nil;
https://google.github.io/styleguide
Hiroshi Ichikawa
2017/04/28 08:47:41
The goal here is to call [_proxy removeObserver:se
Eugene But (OOO till 7-30)
2017/04/28 10:08:57
Thanks!
| |
| 75 } | |
| 76 | |
| 69 #pragma mark - CRWWebViewScrollViewObserver | 77 #pragma mark - CRWWebViewScrollViewObserver |
| 70 | 78 |
| 71 - (void)webViewScrollViewWillBeginDragging: | 79 - (void)webViewScrollViewWillBeginDragging: |
| 72 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 80 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
| 73 SEL selector = @selector(webViewScrollViewWillBeginDragging:); | 81 SEL selector = @selector(webViewScrollViewWillBeginDragging:); |
| 74 if ([_delegate respondsToSelector:selector]) { | 82 if ([_delegate respondsToSelector:selector]) { |
| 75 [_delegate scrollViewWillBeginDragging:self]; | 83 [_delegate scrollViewWillBeginDragging:self]; |
| 76 } | 84 } |
| 77 } | 85 } |
| 78 - (void)webViewScrollViewWillEndDragging: | 86 - (void)webViewScrollViewWillEndDragging: |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 103 [_delegate scrollViewDidEndDecelerating:self]; | 111 [_delegate scrollViewDidEndDecelerating:self]; |
| 104 } | 112 } |
| 105 } | 113 } |
| 106 | 114 |
| 107 - (void)webViewScrollViewDidResetContentSize: | 115 - (void)webViewScrollViewDidResetContentSize: |
| 108 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 116 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
| 109 self.contentSize = _proxy.contentSize; | 117 self.contentSize = _proxy.contentSize; |
| 110 } | 118 } |
| 111 | 119 |
| 112 @end | 120 @end |
| OLD | NEW |