Commit a5ce0391 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Add -[CWVSyncController shutDown]

CWVSyncController needs a way to unobserve signin::IdentityManager
before its associated CWVWebViewConfiguration destroys its
WebViewBrowserState. This avoids a DCHECK in the IdentityManager's
observer list.

Change-Id: I1a0d15bc4bc57a3cf1dd7fbc5a38bdb0adefad0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067472Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743390}
parent 452e849a
...@@ -205,6 +205,9 @@ CWVWebViewConfiguration* gIncognitoConfiguration = nil; ...@@ -205,6 +205,9 @@ CWVWebViewConfiguration* gIncognitoConfiguration = nil;
for (CWVWebView* webView in _webViews) { for (CWVWebView* webView in _webViews) {
[webView shutDown]; [webView shutDown];
} }
#if BUILDFLAG(IOS_WEB_VIEW_ENABLE_SYNC)
[_syncController shutDown];
#endif // BUILDFLAG(IOS_WEB_VIEW_ENABLE_SYNC)
_browserState.reset(); _browserState.reset();
} }
......
...@@ -290,6 +290,12 @@ __weak id<CWVSyncControllerDataSource> gSyncDataSource; ...@@ -290,6 +290,12 @@ __weak id<CWVSyncControllerDataSource> gSyncDataSource;
#pragma mark - Internal Methods #pragma mark - Internal Methods
- (void)shutDown {
_syncService->RemoveObserver(_observer.get());
_identityManager->RemoveObserver(_observer.get());
_signinErrorController->RemoveObserver(_observer.get());
}
// Create and return a callback that is used to notify when a clean up task // Create and return a callback that is used to notify when a clean up task
// completes. // completes.
- (base::OnceClosure)pendingCleanupTaskCallback { - (base::OnceClosure)pendingCleanupTaskCallback {
......
...@@ -41,6 +41,10 @@ class SigninErrorController; ...@@ -41,6 +41,10 @@ class SigninErrorController;
passwordStore:(password_manager::PasswordStore*)passwordStore passwordStore:(password_manager::PasswordStore*)passwordStore
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
// Called by the associated CWVWebViewConfiguration in order to shut
// down cleanly. See CWVWebViewConfiguration's |shutDown| method for more info.
- (void)shutDown;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment