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

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: Merged with origin/master 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
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | ios/web/web_state/ui/crw_web_controller+protected.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 621b49232b5bb6d8457b7fd3bdd543c1872a2758..19c07758bf02f8a53282768c32583dfe7b6e3a92 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -294,8 +294,9 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) {
std::unique_ptr<web::NewWindowInfo> _externalRequest;
- // The WebStateImpl instance associated with this CRWWebController.
- std::unique_ptr<WebStateImpl> _webStateImpl;
+ // WebStateImpl instance associated with this CRWWebController, web controller
+ // does not own this pointer.
+ 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.
@@ -633,12 +634,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.
@@ -685,11 +685,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
}
- (WebState*)webState {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (WebStateImpl*)webStateImpl {
- return _webStateImpl.get();
+ return _webStateImpl;
}
- (void)clearTransientContentView {
@@ -940,9 +940,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
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | ios/web/web_state/ui/crw_web_controller+protected.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698