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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 1874903003: Reversed WebState <-> CRWWebController ownership. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 years, 8 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/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 543697ea9b4f7e0721b6f8e01830d3a1da4cfdcb..cd4eaacd6966f63f1d8ca68a9ad3401ed896d82a 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -278,8 +278,8 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
std::unique_ptr<web::NewWindowInfo> _externalRequest;
- // The WebStateImpl instance associated with this CRWWebController.
- std::unique_ptr<WebStateImpl> _webStateImpl;
+ // Unowned WebStateImpl instance associated with this CRWWebController.
kkhorimoto 2016/04/12 21:36:13 "Unowned" seems kinda strangely worded. It would
Eugene But (OOO till 7-30) 2016/04/13 02:51:26 WC should not make any assumptions about it's owne
Eugene But (OOO till 7-30) 2016/04/13 13:57:58 Eliminated "unowned" word.
+ WebStateImpl* _webStateImpl;
// A set of URLs opened in external applications; stored so that errors
// from the web view can be identified as resulting from these events.
@@ -597,12 +597,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
return [super allocWithZone:zone];
}
-- (instancetype)initWithWebState:(std::unique_ptr<WebStateImpl>)webState {
+- (instancetype)initWithWebState:(WebStateImpl*)webState {
self = [super init];
if (self) {
- _webStateImpl = std::move(webState);
+ _webStateImpl = webState;
DCHECK(_webStateImpl);
- _webStateImpl->SetWebController(self);
_webStateImpl->InitializeRequestTracker(self);
// Load phase when no WebView present is 'loaded' because this represents
// the idle state.
@@ -649,11 +648,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (WebState*)webState {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (WebStateImpl*)webStateImpl {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (void)clearTransientContentView {
@@ -896,9 +895,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// Remove the web view now. Otherwise, delegate callbacks occur.
[self removeWebViewAllowingCachedReconstruction:NO];
- // Tear down web ui (in case this is part of this tab) and web state now,
- // since the timing of dealloc can't be guaranteed.
- _webStateImpl.reset();
+ _webStateImpl = nullptr;
}
- (void)checkLinkPresenceUnderGesture:(UIGestureRecognizer*)gestureRecognizer

Powered by Google App Engine
This is Rietveld 408576698