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

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 b23cfb16c1e4fef17d51286b85b821fd13d90438..faa73dfd8ad6f306f7405e63b3ecfea762337b1e 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -277,8 +277,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.
+ 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.
@@ -578,12 +578,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.
@@ -630,11 +629,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (WebState*)webState {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (WebStateImpl*)webStateImpl {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (void)clearTransientContentView {
@@ -873,9 +872,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